跳至主要內容
Git代理设置

Git代理设置

TaoChenyue...小于 1 分钟

git代理

# set
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890
# unset
git config --global --unset http.proxy
git config --global --unset https.proxy

对于WSL:

安装clash for windows,开启Allow LAN

#!/bin/bash
host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ")
export ALL_PROXY="http://$host_ip:7890"
git config --global http.proxy http://$host_ip:7890
git config --global https.proxy https://$host_ip:7890

保存成一个文件,运行source <file-name>

登录github

# 生成密钥
ssh-keygen -t rsa -C "your-email"
# 开启密钥管理器
eval "$(ssh-agent -s)"
# 添加私钥(删除也是这个,参数 -s)
ssh-add ~/.ssh/id_rsa
# 复制公钥,在GitHub页面上新建一个sshkey
cat ~/.ssh/id_rsa.pub
# 最后登录,yes就好
ssh -T git@github.com
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.8