修改 ~/.gitconfig
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
git token
- 创建一个token: XXXXXXXXXXXXXX
- 设置权限: read_repository
git config --global http.extraheader "PRIVATE-TOKEN:XXXXXXXXXXXXXX"
如果还是不行,配上gitlab.com登录的用户名和密码,修改 ~/.netrc
:
machine gitlab.com
login xxxxx
password xxxxxxxxxxxxxxxxxx