I want to clone some github repositories to computers that have only access to github via an SSH tunnel.
I can use the ssh addresses to clone simple repositories without problems.
When a repository contains submodules, the access method is controled by .gitsubmodules
which often default to https addresses (since this is the recommended way by github).
Is there a way to tell git submodules that it should always use ssh access, even when the address of a submodule is an https address?
Having to clone a repo and modify its .gitsubmodules
just to be able to clone it through an ssh tunnel seems retarded. Hardcoding the access method in a .gitsubmodules
file instead of letting your users choose the appropiate method seems pretty retarded too. I guess there must be a better way but I cannot find it.
You may use git to rewrite the urls
git config --global url."https://".insteadOf git://
You may include a hostname in the expression to restrict the rewrite to a specific host
git config --global url."https://github.com".insteadOf git://github.com
If you do not whant the rewrite rules to be global then just add it to your local scope instead.
See more under section url.<base>.insteadOf
at http://git-scm.com/docs/git-config
更改.gitmodules
的值是更改子模块协议的常用方法,然后是git submodule sync
以更新远程存储库位置。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.