![](/img/trans.png)
[英]Git & Github: can't push or clone via SSH or Https, the requested URL returned error 400
[英]git - Can you clone via HTTPS even if SSH-style git@github is used
我正在尝试通过git submodule update --init --recursive
克隆具有子模块的 git 存储库。 这些子模块都使用“git@github.com:foo/bar.git” URL。 不幸的是,我的工作场所正在阻止 SSH URL 从他们的防火墙中访问。 但是,我可以通过 HTTPS 克隆,没有任何问题。
如前所述,子模块 URL 在存储库中被硬编码为使用 SSH。 Is there a way to tell git to clone these submodule repositories using HTTPS without instead of SSH making any direct modifications to the git repository?
使用git config --global url.<base>.insteadOf
替换 URL。 就像是
git config --global url.https://github.com/.insteadOf git@github.com:
(Please note the colon at the end; it's neccessary to map git@github.com:user/repo.git
to https://github.com/user/repo.git
).
在https://stackoverflow.com/search?q=%5Bgit-submodules%5D+insteadof中查看更多示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.