我无法克隆我的私有git存储库中存在的子模块。我有权访问整个存储库,
使用了以下命令但没有用,请帮忙。克隆现有存储库中子模块的正确方法是什么?
djrecker$ git submodule update --init --recursive
Submodule 'Path' ([email protected]:Path) registered for path 'App'
Cloning into 'Path'...
Permission denied (publickey).
fatal: Could not read from remote repository.
我面临同样的问题。问题出在你的github repo上,你可能正在使用一些旧的ssh密钥。
您需要更新当前的ssh密钥。
Steps involved are:
1. vim ~/.ssh/id_rsa.pub
2. copy the ssh key
3. Go to the github settings
4. Select the option ssh keys
5. Remove the old ssh keys not used anymore.
6. Add a new ssh key.
7. Try running the "git submodule update --recursive"
这对我有用!!
我有这个问题。在我的情况下,没有在服务器上正确设置公钥(〜/ .ssh / id_rsa)。
参考:Git update submodule recursive
# This must be called twice. Once for new and once for existing submodules.
git submodule update --init --recursive
git submodule update --recursive
ssh -vT [email protected]
进行诊断。确保您设置的密钥列在那里。有关权限问题的更多帮助,请遵循以下指南:https://help.github.com/articles/error-permission-denied-publickey/.gitmodules
并确保看起来没问题。根据@VonC的建议,尝试将它们克隆到单独的文件夹中。就我而言,当我使用常规命令行(Git CMD)时,它抱怨同样的问题。然后我尝试了Git Bash,没有任何问题。
有趣的是,在类似的场合使用HTTPS链接为我工作。
在我的情况下,问题是由控制台引起的,它没有要求我输入密码。解决方案是将控制台从CMDER更改为Gitbash。当我使用CMDER时,它没有显示导致此访问被拒绝问题的密码窗口。
用于Linux / GitBash的TortoiseGit / Windows子系统存在同样的问题。解决方案是通过代理(密钥)而不是密码使用身份验证。
对于TortoiseGit:
(没有选美git clone它要求输入密码并按预期工作,但git update失败并出现错误)
对于WS4L:
$ eval `ssh-agent -s`
$ chmod 600 /path/to/key
$ ssh-add /path/to/key
继续git submodule update
我在父文件夹和子文件夹中使用git init创建了一个错误的子模块。刚刚删除了.git文件夹,并在正确的父文件夹中使用git init重新启动。
VS Code中的Win10 + git bash终端。就我而言,我通过VS Code使用git bash。使用子模块时,git弹出一个窗口输入密钥的密码短语。 Bash通过VSCode不会弹出这个。使用windows上下文菜单项,repo文件夹中的“Git Bash Here”,如下所示:Context menu Screen Grab
git submodule update
工作出色。