我从github检出了一个git repo,但它拒绝承认任何远程分支。
这是我尝试过的(名称改为保护有罪):
$ git pull
Already up-to-date.
$ git fetch
$ git remote update
Fetching origin
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
$ git remote show
origin
$ git remote show origin
* remote origin
Fetch URL: git@github.com:Someplace/someproject.git
Push URL: git@github.com:Someplace/someproject.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
$ git remote -v
origin git@github.com:Someplace/someproject.git (fetch)
origin git@github.com:Someplace/someproject.git (push)
在另一台机器上,它只是起作用:
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/somebranch
...
答案 0 :(得分:1)
首先,您可以使用git ls-remote
cd /patH/to/my/repo
git ls-remote
或者,从任何目录:
git ls-remote git@github.com:Someplace/someproject.git
其次,请确保您的本地存储设置为使用the right refspec获取所有分支:
git config remote.origin.fetch refs/heads/*:refs/remotes/origin/*
(由kan建议)
每次我获取新的回购时,我都必须手动编辑配置文件吗?
否,因为refs/heads/*:refs/remotes/origin/*
是任何git clone
使用的默认refspec
除非提及torek,否则您使用git clone --single-branch
possible since Git 1.7.10。