困扰已久的问题,用git push origin master 命令push项目到github上时,总是出现:
fatal : ‘origin’ does not appear to be a git repository
这样的错误,问题在于.git目录下的config文件中只有[core],没有[remote "origin"]和[branch "master"]信息:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true
也就是说当git push origin master的时候,git需要去config中查找提交的分支信息,但是config中又是空的,所以返回这个错误。
解决的方法就是在config文件中添加上[remote "origin"]和[branch "master"]这两个信息:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/github名/仓库名
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
就好啦! ^_^
原文地址:https://www.cnblogs.com/yong2128/p/10060707.html