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 = [email protected]: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 = [email protected]: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?
I found in .git/modules configs for submodules and changed https links to ssh.
After this command works ok:
GIT_SSH_COMMAND="ssh -i /root/.ssh/repo_sub.key" git submodule update --remote misc/repo_sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With