通过 https 更新 Git 子模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11410017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git Submodule update over https
提问by Dunhamzzz
I am sitting on a proxy which only allows http/https traffic only, I am able to clone a repository from Github, but I have to fetch/push using the https URL and username/password.
我坐在一个只允许 http/https 流量的代理上,我可以从 Github 克隆一个存储库,但我必须使用 https URL 和用户名/密码来获取/推送。
Now my issues is a repository with submodules, when I execute git submodule update
it times out, and I can only assume this is because it's using an SSH connection which is blocked. (it doesn't even ask me for a password on private repos)
现在我的问题是一个带有子模块的存储库,当我执行git submodule update
它时超时,我只能假设这是因为它使用了被阻止的 SSH 连接。(它甚至不要求我提供私人回购的密码)
回答by fkoessler
Edit your .gitmodules
file with the https url, for example:
.gitmodules
使用 https url编辑您的文件,例如:
[submodule "vendor/engines/fat_free_crm"]
path = vendor/engines/fat_free_crm
url = https://github.com/fatfreecrm/fat_free_crm.git
Then run git submodule sync
to reflect the change to your .git/config
file.
然后运行git submodule sync
以反映对.git/config
文件的更改。
回答by Alex Wilson
In your .gitmodules
file in the root of your repo, and in the .git/config
file, you should find a section for your submodule. You can edit the url there so it is accessed via https request rather ssh.
在.gitmodules
repo 根目录的文件中,在该.git/config
文件中,您应该找到子模块的一个部分。您可以在那里编辑 url,以便通过 https 请求而不是 ssh 访问它。
Of course it may already be an ssh url, in which case the problem may be something else, but this is the first place to check.
当然它可能已经是一个ssh url,在这种情况下问题可能出在其他地方,但这是首先要检查的地方。