git执行pull命令时报错

  • A+
所属分类:BLOG Linux Share

今天在用git拉取代码的时候报错,内容如下:

You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.

Google了一下发现,默认配置问题:

因为我的git remote配置了两个代码地址,一个别人的,一个自己的,而且.git/config配置里默认的是自己的地址,而我要pull的却是别人的代码。所以报错。

解决方法:

git config -e

修改remote=origin(把branch "master"的默认remote改成你要fetch的地址即可)

[branch "master"]
        remote = origin
        merge = refs/heads/master

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: