I have a git repository A that contains a submodule B. When I execute git submodule update --init --recursive in repository A to update the submodule, I get a Permission denied (publickey) error. The ssh key is correctly added to the remote (gitlab) and I can clone both repositories independently via ssh. Cloning B outside of A works.
Repository B is in the same group as repository A (on gitlab).
I tried the following:
.gitmodules.gitmodules to http--recursiveHow can I solve the problem?
The .gitmodules contains the following content:
[submodule "B"]
path = path_to_B
url= ../B.git
The complete error message:
Cloning into '{path_to_B}'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '{git@.../B.git}' into submodule path '{path_to_B}' failed
Failed to clone '{path_to_B}'. Retry scheduled
Cloning into '{path_to_B}'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '{git@.../B.git}' into submodule path '{path_to_B}' failed
Failed to clone '{path_to_B}' a second time, aborting
Cloning repository B manually into the location of the submodule solved the issue. After that, updating worked again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With