从配置中的特定主机进行git-submodule更新 [英] Make git-submodule update from specific Host in config
问题描述
使用本指南 我已将工作ssh添加到我的工作git-repo中,我可以打电话给 问题是 引发错误 似乎它尝试使用我的个人设置( 我知道了: 调用 (假设您位于 Using this guide here I have created a work ssh-key ( I have added the work ssh to my work git-repo and I can call
The problem is that there is a submodule in throws the error It seems like it tries to pull using my personal setting (
I figured it out: After calling (assume you are in the
这篇关于从配置中的特定主机进行git-submodule更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!#个人GitHub帐户托管github.com主机名github.com用户gitAddKeysToAgent是IdentityFile〜/.ssh/id_rsa#工作GitHub帐户托管github.com-work主机名github.com用户gitAddKeysToAgent是IdentityFile〜/.ssh/id_rsa_work
git clone git@github.com-work:user/test.git
并将其克隆. test
中有一个我无法更新的子模块,调用
git子模块更新
请确保您具有正确的访问权限并且该存储库存在.致命:将"git@github.com:user/Utils.git"克隆到子模块路径"C:/Users/user/Documents/work/test/Utils"失败
git@github.com
)而不是作品( git@github.com-work
)拉动.我已将 git子模块init
调用,并尝试将 .gitmodule
网址修改为
[子模块实用程序"]路径=实用程序网址= git@github.com-work:user/Utils.git
git子模块更新
后,通过以下方式更改URL(尽管出于某些原因,它不会更改,尽管我更改了 .gitconfig
文件): test
文件夹中)
git子模块set-url./Utils/git@github.com-work:user/Utils.git"git更新cd实用程序git checkout主
id_rsa_work
) and changed my config
file to# Personal GitHub account
Host github.com
HostName github.com
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
# Work GitHub account
Host github.com-work
HostName github.com
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa_work
git clone git@github.com-work:user/test.git
and clone it.test
which I cannot update, callinggit submodule update
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:user/Utils.git' into submodule path 'C:/Users/user/Documents/work/test/Utils' failed
git@github.com
) and not the work (git@github.com-work
). I have called git submodule init
and have tried modify the .gitmodule
url to[submodule "Utils"]
path = Utils
url = git@github.com-work:user/Utils.git
git submodule update
change the URL (for some reason it does not change, eventhough I change the .gitconfig
file) bytest
folder)git submodule set-url ./Utils/ "git@github.com-work:user/Utils.git"
git update
cd Utils
git checkout master