- 在github上配置ssh
- 使用以下命令:
git config --global url."git@github.com:".insteadOf "(https://github.com/)"
⚠️注意:这个设置会导致Swift Package Manager拉取不到配置,所以需反向替换一次
- 使用反向替换命令:
git config --global url."https://github.com/apple".insteadOf "(git@github.com:apple)"
最后.gitconfig文件中包含以下两条,即设置完成
[url "git@github.com:"]
insteadOf = (https://github.com/)
[url "https://github.com/apple"]
insteadOf = (git@github.com:apple)