Git submodule update error: Permission Denied Publickey
Join the DZone community and get the full member experience.Join For Free
It could happen when you clone a Git Repository with submodules, issuing a git submodule update command, that you are prompted with this error error.
Cloning into ‘src/xxxx’…
Warning: Permanently added the RSA host key for IP address xxx.xxx.xxx.xxx to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
If you search on the internet for the cause of this error, you can find some people suggesting that the url specified in .gitmodules file is wrong and should be changed, here is my .gitmodule
path = src/CQRS
url = email@example.com:xxxxxx/cqrs.git
branch = master
You could change the url configuration to https url and everything works, but this is not the perfect solution, because the address firstname.lastname@example.org is perfectly valid, but probably there is some problem with your RSA keys stored in Github (or you never configured RSA Keys for your account). In my situation, my RSA Keys had some problem and I needed to recreate another one. If you do not know what a RSA key is and how to create a RSA Key to connect to github I strongly suggest you reading the guide: Generating SSH Keys.
Once you configure a valid certificate in github your submodule should work without problem.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.