如果在.ssh / config中更改了远程URL,git会跟踪它吗?

问题描述 投票:1回答:1

假设我在/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 ssh
1个回答
0
投票

我从来没有检查过,但从配置的其他部分来看,我会说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/*

所以,好吧,它似乎存储了命令行参数中给出的内容的逐字副本。

© www.soinside.com 2019 - 2024. All rights reserved.