Search code examples
gitgit-submodules

Git submodule using a different ssh key?


I'm trying to add a private repository as a git submodule.

I can clone the repository like so git clone <repo_url> but when I use git submodule add <repo_url> <folder_destination> I get back:

Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.


Solution

  • For some reason the ownership on my .git/modules folder had changed to root.

    I was able to fix the issue by running:

    chown -R philip:philip .git/modules/