解决fatal: No remote repository specified. Please, specify either a URL...

来源:互联网 发布:网络主播怎么招聘 编辑:程序博客网 时间:2024/06/05 18:11


今天在电脑上用Git pull命令来更新本地项目,突然发现出现如标题的错误:

[plain] view plain copy print?
  1. user ~/c/quhao$git pull  
  2. fatal: No remote repository specified.  Please, specify either a URL or a  
  3. remote name from which new revisions should be fetched.  
出现这个问题的原因是.git/config的配置出问题了。

解决方法是从其他项目里拷贝一份config过来,再改一下里面的url就可以了,或者用下面的模板:


[plain] view plain copy print?
  1. [core]  
  2.         repositoryformatversion = 0  
  3.         filemode = true  
  4.         bare = false  
  5.         logallrefupdates = true  
  6.         ignorecase = true  
  7.         precomposeunicode = false  
  8. [remote "origin"]  
  9.         url = https://github.com/CrossLee/xxx.git  
  10.         fetch = +refs/heads/*:refs/remotes/origin/*  
  11.         pushurl = https://github.com/CrossLee/xxx.git  
  12. [branch "master"]  
  13.         remote = origin  
  14.         merge = refs/heads/master  
把其中换成你项目的地址就可以了:
[plain] view plain copy print?
  1. url = https://github.com/CrossLee/xxx.git  
  2. pushurl = https://github.com/CrossLee/xxx.git  

0 0