假设我在/home/ibug/.ssh/config
有这个
Host GitHub github GH gh
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
PubKeyAuthentication yes
在当地的回购中,我跑了
git remote set-url origin gh:iBug/foo
git还记得gh:iBug/foo
还是[email protected]:iBug/foo
?
我从来没有检查过,但从配置的其他部分来看,我会说git只记得你提供的“远程网址”文本,所以blahblah:blah/blah
可能会完全存储起来。
由于GIT支持多个遥控器,因此您自己尝试一下就没有任何风险。只需使用git remote -v
或阅读.git/config
,看看有什么。
让我看看我目前使用的一些git repo
quetzalcoatl@LAP049 MINGW32 /c/w/-path-redacted- (develop)
$ git remote add asdf "KJH&*^^IGJH*"
quetzalcoatl@LAP049 MINGW32 /c/w/-path-redacted- (develop)
$ git remote -v
asdf KJH&*^^IGJH* (fetch)
asdf KJH&*^^IGJH* (push)
--other urls redacted--
quetzalcoatl@LAP049 MINGW32 /c/w/-path-redacted- (develop)
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
---other sections redacted---
[remote "asdf"]
url = KJH&*^^IGJH*
fetch = +refs/heads/*:refs/remotes/asdf/*
所以,好吧,它似乎存储了命令行参数中给出的内容的逐字副本。