Pushing/committing with the Jenkins git plugin: #Not on any branch (GitHub repo)

假如想象 提交于 2019-12-24 09:55:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!