git - 如何在不提供用户名/密码的情况下推送对 git 子模块的修改

标签 git git-submodules public-key

我目前正在尝试处理 git 子模块,但当我想将修改推送到子存储库时遇到了麻烦。

我收到以下错误:

fatal: remote error: 
  You can't push to git://github.com/yllieth/ui.git
  Use https://github.com/yllieth/ui.git

事实上,如果我将远程配置更改为使用 HTTPS 而不是 ssh 公钥,它就可以正常工作。但我想避免提供我的 github 的用户名/密码。

有人知道一些配置技巧或其他东西可以使用我的公钥推送到子模块吗?

最佳答案

It's working fine if I change my remote configuration to use HTTPS instead of ssh public key.

请注意git://github.com/yllieth/ui.git不是 ssh URL。
请参阅“Which remote URL should I use?”和“Changing a remote's URL”:

<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1e79776a5e79776a766b7c307d7173" rel="noreferrer noopener nofollow">[email protected]</a>:username/reponame.git会的。
在您的情况下:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e0878994a0878994889582ce838f8d" rel="noreferrer noopener nofollow">[email protected]</a>:yllieth/ui.git

所以你仍然可以使用 ssh,但是你需要change the submodule url .

关于git - 如何在不提供用户名/密码的情况下推送对 git 子模块的修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25998653/

相关文章:

Git 分支 : master vs. origin/master 与 remotes/origin/master

git - 无法从 HEAD 历史记录中确定上游 SVN 信息

git - 使用 Git 和 Nuget 管理内部共享库

openssl - X.509 : Private/Public Key

java - apache sshd公钥认证

git - 使用 git filter-branch 通过提交消息删除提交

git - 在不 check out 的情况下获取先前版本主 repo 中子模块的哈希值

git - git 子模块的不同推/pull url

encryption - 在不暴露明文的情况下更改加密 key

git - git适合做A/B测试,代码交换吗?