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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值