git上传相关错误

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

Git 
更新时间:2020-07-11 23:51:44

本文由 阿俊 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
原文链接:https://jinterest.cn/archives/git
最后更新:2020-07-11 23:51:44

评论

Your browser is out of date!

Update your browser to view this website correctly. Update my browser now

×