栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

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

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

记录在windows、linux、macOS下配置Git,及给Git配置代理的详细步骤。

生成 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 FilesGitetcssh

x86 C:Program Files(x86)Gitetcssh

2.添加配置如下

Host ServerIP

IdentityFile “~/.ssh/id_rsa”

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

如果是x86的版本需要修改mingw64为mingw32

MacOS Linux 设置代理
    安装 connect
# 下载 connect 源码
$ git clone https://github.com/moonagic/connect.git

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

# 将编译后的 connect 二进制文件拷贝到 bin 目录
$ cp connect /usr/local/bin
    修改 ~/.ssh/config 如下
# ServerIP Git服务器IP
# ProxyIP:ProxyPort 代理服务器IP与Port
Host ServerIP
  IdentityFile "~/.ssh/id_rsa"
  ProxyCommand connect -H ProxyIP:ProxyPort %h %p
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/746888.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号