1,输入:git remote add origin git@github.com:yourName/yourRepo.git
时
报错:fatal: Not a git repository (or any of the parent directories): .git
解决办法:输入 git init ,初始化一个本地仓库
2,输入:git remote add origin git@github.com:yourName/yourRepo.git
时
报错:fatal: remote origin already exists.
解决办法:
1 删除Git仓库中的origin信息:git remote rm origin
2 重新添加Git仓库中的origin信息
3,输入:git push origin master
时
报错:fatal: 'origin' 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.
解决办法:重新输入一次:git remote add origin git@github.com:yourusername/test.git
4,输入:git push origin master
时
报错:fatal: remote error:
XXXXXX@qq.com/myarea is not a valid repository name Email support@github.com for help
解决办法:使用git remote rm origin
然后再使用上传命令
5,输入:git push origin master
时
报错:To git@git.oschina.net:yangzhi/hello.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@git.oschina.net:JInterest/test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first merge the remote changes (e.g.
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决办法:出现这个问题是因为github中的README.md
文件不在本地代码目录中。先进行代码合并 git pull --rebase origin master
再执行 git push origin master
6,输入git add ./
时
报错:fatal: Not a git repository (or any of the parent directories): .git
解决办法:先输入git init
,再add