vscode git 不能push

less than 1 minute read

Published:

记录一下问题和解决方法.

开了clash后, git push不了

# 提示以下错误:
Git: fatal: unable to access "https://github.com/hsienshaun/hsienshaun.github.io.git/Recy failure: Connection was reset

Git: fatal: unable to access "https://github.com/hsienshaun/hsienshaun.github,io.git/Failed to connect to github,com port 443 after 21070 ms: Couldn't connect to server

先配置用户

  git config --global user.name "yourName"
  git config --global user.email "yourName@email.com"

在开启shadowsocks的前提下,手动配置git的代理。git客户端输入如下两个命令就可以了。

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
  • http://也可以改成sockets5://,但是区别在于:socks5不支持通过pubkey免密登录github,每次提交代码只能输入用户名和密码。http可以支持免密登录。

取消代理:

git config --global --unset http.proxy
git config --global --unset https.proxy

参考:

  1. 使用vscode中使用git提交代码到gitLab https://blog.csdn.net/qq_26383975/article/details/119215405
  2. git clone出现 fatal: unable to access ‘https://github.com/…‘的解决办法 https://blog.csdn.net/m0_59338367/article/details/130336443