今天使用git获取远程分支时,只能获取master,即使git fetch也依然只能获取master,以下是我的解决方法:
找到.gitconfig文件(即保存用户名和密码的这个文件),在底下加上一行设置:
[remote "origin"]url = /ga1239/first-demofetch = +refs/heads/*:refs/remotes/origin/*
第一行的url为github项目所在url,修改成你要获取的分支所在的项目地址!
之后git fetch后就能获取所有远程分支了
若出现fatal: ‘/xxx.git’ does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
说明url没填对,重新填吧