新手操作github错误集锦

win10从本地上传代码到github上采坑集锦

我上传时主要参考教程 https://blog.csdn.net/zamamiro/article/details/70172900

常烈建议大家参考上述博客链接,少采一些坑,也许你看了上边的博客就不需要继续往下看了。。

下边是可能会遇到的各种各样的错误,大家请对号入座~

1. 错误:Git"Could not read from remote repository.Please make sure you have the correct access rights."

原因:没有创建公匙
解决办法:

https://blog.csdn.net/u014702999/article/details/72783140

2.错误:Key is invalid. Ensure you've copied the file correctly

原因:添加公匙时只添加了一个
解决办法:

https://blog.csdn.net/w2462140956/article/details/82183174

3.错误:Repository not found。fatal: Could not read from remote repository.

解决办法:

https://blog.csdn.net/weixin_40886892/article/details/80725071

4.错误:Could not open a connection to your authentication agent

解决办法:先执行以下命令,然后再add . 一次

ssh-agent bash
5.警告:
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory

问题:win换行符为crlf,但是linux下为lf
解决办法:输入命令:

 git config core.autocrlf false
6.错误:fatal: remote origin already exists.

解决办法:执行以下命令

git remote rm origin
7.git push -u origin master时出现在这里插入代码片
error: failed to push some refs to 'https://github.com/gpp-gpu/python1.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原因:本地和仓库的代码版本不匹配
解决:
(1)git pull
(2)git push -u origin master
如果git pull出错:fatal: refusing to merge unrelated histories
原因:

https://www.centos.bz/2018/03/git-%E5%87%BA%E7%8E%B0-fatal-refusing-to-merge-unrelated-histories-%E9%94%99%E8%AF%AF/

解决:git pull origin master --allow-unrelated-histories

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值