Jasper van den Bosch
Jasper van den Bosch

Reputation: 3218

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

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?

Upvotes: 1

Views: 4938

Answers (1)

c00kiemon5ter
c00kiemon5ter

Reputation: 17614

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.

Upvotes: 4

Related Questions