Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refusing to fetch into current branch refs/heads/master of non-bare repository #26

Open
leodido opened this issue Jul 8, 2016 · 4 comments

Comments

@leodido
Copy link

leodido commented Jul 8, 2016

The following command

GIT_DEPLOY_DIR=deploy \
GIT_DEPLOY_BRANCH=master \
GIT_DEPLOY_REPO=https://<token>@github.com/<org>/<org>.github.io.git \
git-directory-deploy --verbose -m 'New: Deploy'

gives the following error

fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

Any idea?

I think it depends on the fact that I'm pushing to the master branch (of another repository) while I am on the master locally.

@edpittol
Copy link

edpittol commented Jul 27, 2016

I had the same problem. In my repo I had only the gh-pages branch. What I did was create and checkout the master branch and execute the deploy.sh.

See the difference between the branches:
https://github.com/taquarivalley/conectado-iot

@X1011
Copy link
Owner

X1011 commented Aug 25, 2016

hi, @leodido, sorry for the delay in responding. (looks like I messed up again last time I messed with my notification settings.) You are correct that the error is because you are on master while deploying to master; the script doesn't expect that. I'm guessing you're working in a separate repo with the source files and only using the GitHub pages repo to deploy the production files. The script is designed on the assumption that you are working in a clone of the remote repo, so that the deploy branch exists in both repos with the same name.

I suppose your use case could be supported if we allowed the deploy branch to be specified as a local / remote pair, like in the git push command, but I can't promise I'll ever get around to implementing that.

@ericsoco
Copy link

Note for future Googlers, I ended up with this error when i tried to git-directory-deploy while my internet connection was down. My deploy script switched over to my gh-pages branch, failed, and then stayed on that branch; when I restored my internet connection and ran it again I was still on the gh-pages branch.

That caused the error described here, trying to fetch the current branch. Resetting and checking out master resolved the problem for me.

@inyee786
Copy link

inyee786 commented Oct 25, 2018

I also face the same problem

this answer clear all the doubt

https://stackoverflow.com/questions/29028696/why-git-fetch-origin-branchbranch-works-only-on-a-non-current-branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants