场景

公司自建的 gitlab 没有域名,只有 ip,

我本地电脑全局默认个人 git 配置 和 ssh 配置,指定目录下为对应的工作配置

个人 git 配置:

# ~/.gitconfig
[user]
	name = sean2077
	email = sean2077@163.com
 
[core]
	editor = \"C:\\Users\\sean2\\AppData\\Local\\Programs\\Microsoft VS Code\\bin\\code\" --wait
 
[https]
	proxy = 127.0.0.1:7890
 
[http]
	proxy = 127.0.0.1:7890
	sslBackend = schannel
 
[includeIf "gitdir/i:C:/Workspace/manifold_ai/**"]
  path = C:/Users/sean2/.gitconfig-work
 

工作 git 配置

# ~/.gitconfig-work
[user]
  name = sean
  email = sean@manifoldai.cn
 

ssh 配置:

~/.ssh/config:

Host 115.190.113.67
  User git
  Port 22
  IdentityFile C:/Users/sean2/.ssh/id_ed25519_work
  IdentitiesOnly yes
  PreferredAuthentications publickey

注:由于开启了全局代理,拉取公司的私域仓库时最好用 ssh 的方式