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