I'm using main private repository from github. I added deploy key in settings on github and pulling by command:
GIT_SSH_COMMAND="ssh -i /root/.ssh/repo.key" git pull
Also I edit .git/config file:
[remote "origin"]
url = git@github.com:username/reponame.git
fetch = +refs/heads/*:refs/remotes/origin/*
And it works. But I also have a submodule (in private repo) and I want to pull it by ssh key like main repo. I tried to add new key to submodules repo and edit .git/config:
[submodule "misc/repo_sub"]
url = git@github.com:username/repo_sub.git
GIT_SSH_COMMAND="ssh -i /root/.ssh/repo_sub.key" git submodule update --remote misc/repo_sub
Also i tried:
cd misc/
GIT_SSH_COMMAND="ssh -i /root/.ssh/repo_sub.key" git pull
But it does not work too.
So how can I update submodules from private github repo by key or how can i pull them by key?