第一次提交
- 现在master改为了main
git init git add . git status git commit -m "first commit" git remote add origin https://github.com/genghenggao/resume.git # 第一次 git push -u origin main
正常提交
git add . git commit -m "commit log" git push origin main
Git error
报错1:443: Timed out
$ git pull origin master --allow-unrelated-histories fatal: unable to access 'https://github.com/genghenggao/henggao_notion_blog.git/': Failed to connect to github.com port 443: Timed out
解决
方法一
上面的加速GitHub访问(强烈推荐✨✨✨)
方法二
- 打开连接:https://ipaddress.com/website/github.com,复制IP地址
140.82.114.3
199.232.69.194
- 打开链接:https://ipaddress.com/website/assets-cdn.github.com ,复制IP地址
185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153
- 打开电脑的hosts文件,添加
140.82.114.3(图1的IP Address) github.com 199.232.69.194(图2的IP Address) github.global.ssl.fastly.net 185.199.108.153(图3的IP Address) assets-cdn.github.com 185.199.109.153(图3的IP Address) assets-cdn.github.com 185.199.110.153(图3的IP Address) assets-cdn.github.com 185.199.111.153(图3的IP Address) assets-cdn.github.com
- 在终端在输以下指令刷新DNS(需要权限)
Windows下,打开终端CMD
ipconfig/flushdns
MAC操作系统
sudo killall -HUP mDNSResponder;say DNS cache has been flushed
报错2:errno 10054
$ git push origin master fatal: unable to access 'https://github.com/genghenggao/henggao_notion_blog.git/': OpenSSL SSL_read: Connection was reset, errno 10054
原因
- 产生原因:一般是这是因为服务器的SSL证书没有经过第三方机构的签署,所以才报错
解决
- 解除ssl验证后,再次git即可
git config --global http.sslVerify "false"
报错3:failed to push some refs
$git push origin master To https://github.com/genghenggao/henggao_notion_blog.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/genghenggao/henggao_notion_blog.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.
解决
# 把远程仓库和本地同步,消除差异 git pull origin master --allow-unrelated-histories git add . git commit -m 'henggao' git push origin master