0
点赞
收藏
分享

微信扫一扫

【随笔记】MacOS系统下设置Git及配置代理详细记录

绣文字 2022-02-18 阅读 129
gitmacosssh

生成 ssh 秘钥对

# 生成 ssh 秘钥对,一路回车
$ ssh-keygen -t rsa

# 查看公钥
$ cat ~/.ssh/id_rsa.pub

配置用户名 邮箱

# 设置用户名
$ git config --global user.name "your name"

# 设置密码
$ git config --global user.email "your email"

Windows 代理设置

1.安装git找到安装目录下的ssh_config文件

x64 C:\Program Files\Git\etc\ssh

x86 C:\Program Files(x86)\Git\etc\ssh

2.添加配置如下

Host ServerIP

IdentityFile “~/.ssh/id_rsa”

ProxyCommand /mingw64/bin/connect.exe -H ProxyIP:ProxyPort %h %p

MacOS Linux 设置代理

  1. 安装 connect
# 下载 connect 源码
$ git clone https://github.com/moonagic/connect.git

# 编译 connect 源码
$ cd connect && make

# 将编译后的 connect 二进制文件拷贝到 bin 目录
$ cp connect /usr/local/bin
  1. 修改 ~/.ssh/config 如下
# ServerIP Git服务器IP
# ProxyIP:ProxyPort 代理服务器IP与Port
Host ServerIP
  IdentityFile "~/.ssh/id_rsa"
  ProxyCommand connect -H ProxyIP:ProxyPort %h %p
举报

相关推荐

基础 随笔记录,补缺

设置取消git配置的http或https代理

git 配置记录

为git设置网络代理

mac git、brew设置代理

0 条评论