# 设置用户名、邮箱
git config --global user.name "netnr"
git config --global user.email "netnr@netnr.com"
# 查看
cd ~/.ssh && ls
# 生成密钥(ED25519 更小更快更安全,需要 OpenSSH 6.5 以上,推荐),密钥均为 256 位
ssh-keygen -t ed25519 -C "netnr"
# 查看公钥,拷贝到 GitHub => Settings => SSH and GPG keys => New SSH key
cat id_ed25519.pub
# 权限
chown 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
# ssh 代理 vi ~/.ssh/config
Host github.com
HostName ssh.github.com
User git
Port 443
ProxyCommand nc -X 5 -x 127.0.0.1:7897 %h %p
IdentityFile ~/.ssh/id_ed25519
# New Ncat
# ProxyCommand nc --proxy-type socks5 --proxy 127.0.0.1:7897 %h %p
# Windows 配置使用 git 的 connect
# ProxyCommand "C:/Program Files/Git/mingw64/bin/connect.exe" -S 127.0.0.1:7897 %h %p
# 验证是否成功,有 successfully 字样
ssh -T git@github.com
# 接下来
git clone git@github.com:netnr/proxy.git