1,输入:git remote add origin

报错:fatal: Not a git repository (or any of the parent directories): .git

解决办法:输入 git init ,初始化一个本地仓库

2,输入:git remote add origin

报错: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

4,输入:git push origin master

报错:fatal: remote error:
 is not a valid repository name Email for help

解决办法:使用git remote rm origin然后再使用上传命令

5,输入:git push origin master


                ! [rejected]        master -> master (fetch first)

               error: failed to push some refs to ''

               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

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

本文由 阿俊 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
最后更新:2020-07-11 23:51:44


Your browser is out of date!

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