Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Git submodule update error: Permission Denied Publickey

DZone's Guide to

Git submodule update error: Permission Denied Publickey

· Agile Zone
Free Resource

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!

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

[submodule "src/CQRS"]
  path = src/CQRS
  url = git@github.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 git@github.com 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.

Gian Maria.

CA App Experience Analytics, a whole new level of visibility. Learn more.

Topics:

Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}