GIT命令在gitbash中工作,但不是来自Jenkins

GIT命令在gitbash中工作,但不是来自Jenkins,git,jenkins,git-bash,Git,Jenkins,Git Bash,我试图使用Windows服务器上的Jenkins作业,通过以下命令将某个子目录中的所有分支推送到另一个远程目录中的另一个子目录: git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/featureReady/*' 这适用于GIT bash: $ git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/fe

我试图使用Windows服务器上的Jenkins作业,通过以下命令将某个子目录中的所有分支推送到另一个远程目录中的另一个子目录:

git push bitbucket '+refs/remotes/origin/featureReady/*:refs/heads/company/featureReady/*'
这适用于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
但是,当Jenkins运行相同的作业时,不会检测到新的分支:

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
我已尝试将shell可执行文件设置为%PROGRAMFILES%\Git\bin\sh.exe(指定绝对路径),如前所述,但效果相同

你知道是什么使这些行为不同,以及如何修复詹金斯的工作吗

[编辑]git状态结果:

$ git status
HEAD detached at 253c965
nothing to commit, working tree clean
[edit2]为了进行测试,我总是删除BitBucket服务器中创建的分支,使其具有相同的初始状态。所有命令(Jenkins、gitbash和windows命令行)都在同一个文件夹中运行,即Jenkins签出文件夹


[edit3]使用Windows命令行运行命令时,结果也是所有内容都是最新的

可能在服务器上所有内容都是最新的?您能在分支头上运行revparse并比较散列吗?不幸的是,它不是。该分支在运行Jenkins任务后没有出现在BitBucket中。如果我在git bash中运行该命令,它就在那里,并且分支存在于jenkins上的
refs/remotes/origin/featureReady/
中?(
git branch-a
)当您与Jenkins一起运行时,是否可以检查
git status
的输出?我在Jenkins作业目录中运行git bash,以确保得到相同的结果。当它使用git bash成功提交分支时,我将删除BitBucket中的de branch。我将用
git status
结果更新我的答案。也许服务器上的一切都是最新的?您能在分支头上运行revparse并比较散列吗?不幸的是,它不是。该分支在运行Jenkins任务后没有出现在BitBucket中。如果我在git bash中运行该命令,它就在那里,并且分支存在于jenkins上的
refs/remotes/origin/featureReady/
中?(
git branch-a
)当您与Jenkins一起运行时,是否可以检查
git status
的输出?我在Jenkins作业目录中运行git bash,以确保得到相同的结果。当它使用git bash成功提交分支时,我将删除BitBucket中的de branch。我将用
git状态
结果更新我的答案。