2.git 连接报"ssh: connect to host github.com port 22: Connection timed out"错误

FAQ:

1.gitee 无法pull仓库refusing to merge unrelated histories

我之前在gitee上创建一个project后,想push本地的项目至gitee仓库,按照官方操作如下:

简易的命令行入门教程:

Git 全局设置:

git config --global user.name "wusiquan"
git config --global user.email "[email protected]"

创建 git 仓库:

mkdir springboot-demo
cd springboot-demo
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:wusiquan/springboot-demo.git
git push -u origin master

已有项目?

cd existing_git_repo
git remote add origin [email protected]:wusiquan/springboot-demo.git
git push -u origin master

当执行

git push -u origin master
的时候出现该错误,后来发现是因为本地的project和远程仓库的project的提交histories并不相关,所以

需要在pull 后面添加 --allow-unrelated-histories

git pull origin master --allow-unrelated-histories

执行完成成后在执行push操作即可。


2.git 连接报"ssh: connect to host github.com port 22: Connection timed out"错误

原因是我本地存在多个git账号,需要为每个git账号配置一个指定的ssh文件,解决请看

http://blog.csdn.net/woshuo424479703/article/details/78643880

猜你喜欢

转载自blog.csdn.net/woshuo424479703/article/details/78644002