-
Bug
-
Resolution: Unresolved
-
Minor
-
None
I use pipline
checkout([ $class: 'GitSCM', userRemoteConfigs: [[url: env.GIT_PATH, credentialsId: 'loongle' ]], branches: [[name: 'main']], doGenerateSubmoduleConfigurations: false, extensions: [[ $class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false]], submoduleCfg: [] ])
First time normal execution after project creation,if i update the submodule, then it will have the following error
hudson.plugins.git.GitException: Command "git submodule update --init --recursive modules/data-management" returned status code 1: stdout: stderr: error: Your local changes to the following files would be overwritten by checkout: Yoofast.HuarenSport.DataManagement.sln src/Yoofast.HuarenSport.DataManagement.Domain/Yoofast.HuarenSport.DataManagement.Domain.csproj Please commit your changes or stash them before you switch branches. Aborting Unable to checkout 'd352127edb42899e53550635530c396d1257c77e' in submodule path 'modules/data-management'
I think adding a parameter: --foce solves this problem, the final execution code might look something like this
git submodule update --init --recursive --force modules/data-management
withCredentials cannot be used because there is no user name and password
withCredentials([gitUsernamePassword(credentialsId: 'my-credentials-id', gitToolName: 'git-tool')]) { powershell 'git push' }