TL;DR

某个项目 mod 托管在 gitcode,无法拉取。git 登陆也不行,需要配置 git 针对 gitcode 默认走 ssh 协议:

git config --global url."ssh://[email protected]".insteadOf "https://gitcode.com"

在网上查到比较多的是针对 gitlabgithub 的:

# gitlab
git config --global url."ssh://git@gitlab-company".insteadOf "https://gitlab.xxx.cn"

# github的同理
git config --global url."ssh://git@github-company".insteadOf "https://github.com"

配置后就可以正常 go mod tidy 了。

Refs

最后修改:2025 年 10 月 14 日
如果觉得我的文章对你有用,请随意赞赏