I'm trying to push all branches in a certain subdirectory to another subdirectory in another remote using a Jenkins job on a Windows server with this command:
git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/featureReady/*'
This works with GIT bash:
$ git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/featureReady/*'
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 663 bytes | 0 bytes/s, done.
Total 7 (delta 6), reused 0 (delta 0)
remote:
remote: Create pull request for company/featureReady/M5-UC-XXX_TestSyncProcess:
remote: http://xxx/projects/project_name/repos/myrepo/compare/commits?sourceBranch=refs/heads/company/featureReady/M5-UC-XXX_TestSyncProcess
remote:
To ssh://xxx/project/project.git
* [new branch] origin/featureReady/M5-UC-XXX_TestSyncProcess -> company/featureReady/M5-UC-XXX_TestSyncProcess
But when Jenkins runs the same job, the new branch is not being detected:
C:\CI-Tools\Jenkins\workspace\myjob>git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/featureReady/*' --dry-run --verbose
Pushing to ssh://xxx/project/project.git
Everything up-to-date
I've tried setting the shell executable to %PROGRAMFILES%\Git\bin\sh.exe (specifying the absolute path) as described here, but the effect is the same.
Any idea what makes these behave differently and how to fix the jenkins job?
[edit] git status result:
$ git status
HEAD detached at 253c965
nothing to commit, working tree clean
[edit2] To test I always delete the branch created in the BitBucket server to have the same initial state. All the commands (Jenkins, GIT Bash and windows command line) are being ran in the same folder, which is the Jenkins checkout folder.
[edit3] When running the command with the Windows command line the result is also Everything up-to-date