Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal Error when updating submodule using GIT

I am trying to update the submodules of this git repositary but I keep getting a fatal errors:

[root@iptlock ProdigyView]# git submodule update --recursive Cloning into core... Permission denied (publickey). fatal: The remote end hung up unexpectedly Clone of '[email protected]:ProdigyView/ProdigyView-Core.git' into submodule path 'core' failed 

Or this way

[root@iptlock root]# git clone --recursive https://github.com/ProdigyView/ProdigyView.git Cloning into ProdigyView... remote: Counting objects: 438, done. remote: Compressing objects: 100% (275/275), done. remote: Total 438 (delta 172), reused 394 (delta 128) Receiving objects: 100% (438/438), 8.03 MiB | 5.19 MiB/s, done. Resolving deltas: 100% (172/172), done. Submodule 'core' ([email protected]:ProdigyView/ProdigyView-Core.git) registered for path 'core' Cloning into core... Permission denied (publickey). fatal: The remote end hung up unexpectedly Clone of '[email protected]:ProdigyView/ProdigyView-Core.git' into submodule path 'core' failed 

Any ideas of why this is happening withthe submodule? The repo is this one:

https://github.com/ProdigyView/ProdigyView

(The submodule is able to be cloned if I do not try to clone it as a submodule.)

like image 927
Devin Dixon Avatar asked Nov 19 '11 20:11

Devin Dixon


People also ask

How do I update git submodules to latest version?

In order to update an existing Git submodule, you need to execute the “git submodule update” with the “–remote” and the “–merge” option. Using the “–remote” command, you will be able to update your existing Git submodules without having to run “git pull” commands in each submodule of your project.

How do I update a submodule in git recursive?

If you already cloned the project and forgot --recurse-submodules , you can combine the git submodule init and git submodule update steps by running git submodule update --init . To also initialize, fetch and checkout any nested submodules, you can use the foolproof git submodule update --init --recursive .

How do I update a specific submodule?

By adding the submodule. <name>. update config setting, you ensure that the selective clone of the submodule will be followed by an update, only for that submodule.


1 Answers

The issue is that git can't find the public key needed to download the repo from your server, the solution is to use the public url.

In the file .gitmodule you will find the following entry:

[submodule "example"]     path = example     url = [email protected]:webhat/example.git 

The URL need to be changed to the public URL for the module:

[submodule "example"]     path = example     url = https://github.com/webhat/example.git 

As you can see the prefix git@ has been changed to https:// and the infix : becomes /

EDIT: In your own repository you might need to use git:// rather than https://

The previous answer was unclear to me, so I added this.

EDIT 2: If you find you need to run git submodule sync or need to edit .git/config to get this to work, you have likely set up remotes for the submodules.

like image 111
Daniël W. Crompton Avatar answered Sep 24 '22 15:09

Daniël W. Crompton