‘连接git错误’'error: '‘failed to push some refs to’
错误提示
bash
error: failed to push some refs to
分析原因
我们在创建仓库的时候,都会勾选“使用Reamdme文件初始化这个仓库”这个操作初识了一个README文件并配置添加了忽略文件。当点击创建仓库时,

它会帮我们做一次初始提交。于是我们的仓库就有了README.m和.gitignore文件,然后我们把本地项目关联到这个仓库,并把项目推送到仓库时,我们在关联本地与远程时,两端都是有内容的,但是这两份内容并没有联系,当我们推送到远程或者从远程拉取内容时,都会有没有被跟踪的内容,于是你看git报的详细错误中总是会让你先拉取再推送,但是拉取总是失败。
解决方法
方法一
bash
git pull --rebase origin master
然后再提交
bash
git push -u origin master
方法二
在创建仓库的时候不要勾选“使用Readme文件初始化这个仓库”。
这样直接在本地git clone 仓库,然后使用直接git push就可以了

‘fatal: destination path ‘.‘ already exists and is not an empty directory.’
发现问题
bash
fatal: destination path ‘.‘ already exists and is not an empty directory.
分析问题
正如报错信息所说的,当前目录已经存在了 git 工程,把.git删掉即可
解决问题
方法一
删掉.git
bash
rm -rf .git
重新拉取仓库
bash
git clone 仓库地址
方法二
使用rm -rf .git删掉.git无法恢复,如果没有把握,还是新建一个文件夹比较稳妥
bash
mkdir test
cd test
git clone 仓库地址
‘fatal: ‘‘origin’’ does not appear to be a git repository’
发现问题
bash
fatal: 'origin' does not appear to be a git repository
分析问题
在给仓库远程提交信息时,发现没找到origin这个仓库。
bash
git push -u origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
解决问题
bash
git remote -v # 查看远程仓库详细信息,可以看到仓库名称
git remote remove orign # 删除orign仓库(如果把origin拼写成orign,删除错误名称仓库)
git remote add origin 仓库地址 # 重新添加远程仓库地址
gti push -u origin master # 提交到远程仓库的master主干
OpenSSL SSL_read: Connection was reset, errno 10054
错误内容

解决方法
报错原因:服务器的SSL证书没有经过第三方权威机构的认证,觉得你的请求不安全。关了梯子就行。
‘fatal: Could not read from remote repository.’
发现问题
bash
fatal: Could not read from remote repository.

解决问题
生成新的rsa
bash
ssh-keygen -t rsa -C "aa1***56@gmail.com"
# 你的github邮箱
将rsa复制到GitHub


‘fatal: not a git repository (or any of the parent directories): .git’
发现问题

bash
fatal: not a git repository (or any of the parent directories): .git
分析问题
提示说没有.git仓库,没有的话,那我初始化一下好了
解决问题
bash
git init
git push -u origin master
本文是原创文章,采用 CC BY-NC-SA 4.0 协议,完整转载请注明来自 小码同学
评论
隐私政策
0/500
滚动到此处加载评论...

