如何使用SSH代替HTTP用于Git子模块? [英] How to use SSH instead of HTTP for Git submodules?

查看:317
本文介绍了如何使用SSH代替HTTP用于Git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



$ git clone --recursive git@github.com:acani / Chats.git
克隆到'聊天中'...
权限被拒绝(publickey)。
致命:无法从远程存储库读取。



请确保您拥有正确的访问权限并存在存储库。



https://github.com/acani/Chats/问题/ 53#issuecomment-118014684



我已经阅读了一些说明,将子模块URL从SSH更改为HTTP,但为什么我必须去做。我不想这样做。我想保持它的SSH,以便我不必输入我的用户名&如果我想推送到终端的密码。每个人都可以克隆SSH URL,所以为什么他们不能将它作为子模块进行递归克隆?

解决方案

作为一种解决方法,你可以尝试使用https url来访问任何github仓库:

  cd myParentRepo 
git config url.https:// github .com / .insteadOf ssh://git@github.com/
#或
git config url.https://github.com/.insteadOf git@github.com:


Why are people having this problem?

$ git clone --recursive git@github.com:acani/Chats.git Cloning into 'Chats'... Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

https://github.com/acani/Chats/issues/53#issuecomment-118014684

I've read some answers that say to change the submodule URL from SSH to HTTP, but why should I have to do that. I don't want to do that. I want to keep it SSH so that I don't have to enter my username & password into Terminal if I want to push. Everyone can clone the SSH URL fine, so why can't they recursively clone it as a submodule?

解决方案

As a workaround, you can try using https url for any github repo:

cd myParentRepo
git config url.https://github.com/.insteadOf ssh://git@github.com/
# or
git config url.https://github.com/.insteadOf git@github.com:

这篇关于如何使用SSH代替HTTP用于Git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆