I have two git identities, one is a personal one and the other is for my employer.
My work project uses a submodule and although I can clone the main repo fine, I am not able to update the submodule. What do I need to configure so the submodule can also be updated locally without getting the following error?
Fetching origin
From github.com:/work_domain/work_submodule
* branch HEAD -> FETCH_HEAD
error: pathspec 'master' did not match any file(s) known to git.
I have 2 sets of id_rsa keys in my ~/.ssh directory:
id_rsa.pub <= personal ssh key
id_rsa_work.pub <= work ssh key
~/.ssh/config file:
#work acccount
Host github-work
HostName github.com
User git (corrected with info from answers)
IdentityFile ~/.ssh/ida_rsa_work
#personal account
Host github-personal
HostName github.com
User git
Identity ~/.ssh/ida_rsa
When I initially cloned my work repo successfully, I used the adjusted host mapping:
git clone git@github-work:work_domain/repo_name.git
instead of what I normally use when at work:
git clone git@github.com:work_domain/repo_name.git
Within the work project repo, the .gitmodules file of course has the official mapping:
[submodule "work_submodule"]
path = work_submodule
url = git@github.com:/work_domain/work_submodule.git
Per suggestion below, I updated the .gitmodules attribute to be:
[submodule "work_submodule"]
path = work_submodule
url = git@github-work:/work_domain/work_submodule.git
But still can't update the submodule locally.