1.查看 git 远程仓库的访问方式
git remote -v
[root@VM-0-11-centos lnkwash]# git remote -v
origin https://gitee.com/test/test.git (fetch) origin https://gitee.com/test/test.git (push)
2.git remote set-url origin 你ssh地址
git remote set-url origin git@gitee.com:test/test.git
3.确认代码配置是否正确
这一步很重要,我切换完了,查看-v也是没有问题的
然后无法push代码
最后才发现配置没生效
git config -e
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@gitee.com:test/test.git fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master