问题
I am using the Git Plugin of Jenkins and have a Job that needs to commit and push some changes. The git repository I am using is hosted on GitHub. Bear with me, I am somewhat new to git.
However, when I run git status
or git commit
it says # Not on any branch
. If I tell the plugin to use a 'branch specifier', i.e. origin/master
this doesn't help.
Ho do I get the plugin to behave as if I would have done git clone
on my desktop?
回答1:
you have run git checkout <some-sha>
probably, so now git
is looking at that commit, but is not on the tip of any branch.
If you've done work where you are now, save it with git diff > savefile.tmp
and then checkout to the branch you want: git checkout master
,
and then apply the work you've done: patch -p1 < savefile.tmp
,
fix any conflicts, and git commit
your work.
Then you can git push
.
If no work is done where you stand, then just checkout to master and push.
来源:https://stackoverflow.com/questions/10172454/pushing-committing-with-the-jenkins-git-plugin-not-on-any-branch-github-repo