【git】fatal: unable to access/Fai

2022-12-06  本文已影响0人  AntiGravity

如果有proxy,可以对github.com设置proxy(最好不要全局)。

方式一,输入命令:
git config --global http.https://github.com.proxy http://127.0.0.1:7890 #端口号取决于软件
git config --global https.https://github.com.proxy https://127.0.0.1:7890

注意:不要设置socks5,它授权会失败,无法通过账号密码授权。

方式二,更改.gitconfig(win在用户文件夹下):
[http "https://github.com"]
    proxy = http://127.0.0.1:7890
[https "https://github.com"]
    proxy = http://127.0.0.1:7890
附:git常规创建仓库方式
  1. 进入代码文件夹,右键git bash
  2. 输入
git init
git add .
git commit -m "something"
  1. 在git或gitee创建空仓库,复制地址得到address
git remote add origin "address"
git push -u origin master
  1. 如之前未配置过username和password,需要配置
git config --global user.name [username] # 不需引号
git config --global user.email [email]
  1. 如origin已被占用,可以先删除旧的origin
git remote show origin #查看旧的origin
git remote remove origin #删除
  1. 或者单纯地换一个名字,别用origin了……
上一篇 下一篇

猜你喜欢

热点阅读