Git Push Branch Other Than Master -
this question has answer here:
i've looked solid answer on this, , haven't found relevant. working remote git repository pushing branch not master remote repo. example:
git checkout -b new_branch git add --all . git commit -m "changes" git push remote new_branch
however, when try clone bare remote repository, error:
git clone /path/to/repo.git warning: remote head refers nonexistent ref, unable checkout.
i'm not sure why head detached , not pointing last commit on new_branch? how can clone remote repository?
the warning: remote head refers nonexistent ref, unable checkout.
means remote (bare) repository contains branch reference in file head
not match published branch in same repository.
note warning means git didn't checkout. cloned repository otherwise fine. git branch -a
see possible branches , git checkout the-branch-you-want
workaround issue.
this happens because default contents file ref: refs/heads/master
says if going clone
repository, should default clone branch refs/heads/master
. default git create local branch without refs/heads/
prefix (that is, master
default). try git symbolic-ref
more information.
the problem situation git not provide method modifying remote symbolic refs either use git hosting provider has implemented (e.g. settings - default branch in github if have admin rights) or have use branch name master
default branch (because that's default value symbolic ref).
one way hit issue create new remote bare repo no commits , git push name-of-the-remote my-special-branch-name
result in bare repository containing single branch my-special-branch-name
head
symbolic ref still contains default value pointing master
. result, you'll aforementioned warning.
see : this post
Comments
Post a Comment