GitHub常见错误整理

1.does not appear to be a git repository 

[root@myhost Linux-Note]# git push -u ogrin master

报错信息:

fatal: 'ogrin' 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 -v 查看远程仓库的名

[root@myhost Linux-Note]# git remote -v
origin    https://github.com/ck784101777/Linux-Note.git (fetch)
origin    https://github.com/ck784101777/Linux-Note.git (push)
 

这里origin是我的远程库名,再看看之前的命令:git push -u ogrin master  。 发现我的origin打成了ogrin,所以报错

解决步骤:

1)查看远程库名 git remote -v

2)核对库名,再输入上传命令

 

 

2.fatal: remote origin already exists.

[root@myhost Linux-Note]# git remote add origin https://github.com/ck784101777/Linux-Note.git

报错信息:
    fatal: remote origin already exists

错误分析:

    origin仓库已存在,所以我们需要更换一个仓库名,也可以删除远程仓库,再上传

 

解决步骤1:

  1)查看远程仓库 git remote -v

  2)上传时更换仓库名 git remote add origin2 https://github.com/ck784101777/Linux-Note.git

 

解决步骤2:

  1)查看远程仓库 git remote -v

  2)删除仓库 git remote rm origin

  3)上传 git remote add origin https://github.com/ck784101777/Linux-Note.git

 

 

3.src refspec master does not match any.

[root@myhost Linux-Note]# git push -u origin master

报错信息:

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/ck784101777/Linux-Note.git'
 

报错分析:

上传失败的原因是系统没有匹配到需要提交的文件(本地仓库是空的),也就是说你并没有 git commit ,如下

[root@myhost Linux-Note]# git status
# On branch master
nothing to commit, working directory clean
 

解决步骤:

1)查看状态 git status

2)提交到本地仓库 git commit -m 'xx'

3)上传 git push -u origin master

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值