I’m have a script that needs to be invoked with sudo, but there is one part where I have to clone a GIT repo git clone foo:repo path/to/files, and to do that it needs my regular users ssh key, which is all defined in my regular users $HOME/.ssh/config file.
.ssh/config:
host foo
HostName foo.com
User myuser
IdentityFile ~/.ssh/id_rsa
is there a way when when calling this script to keep my ssh config data so the repo can be cloned? I tried passing -E flag to sudo, but it didn’t seem to have any effect.
all credit goes to @that-other-guy from comments to original post.
instead of:
which, since I’m sudo-ing, causes my clone to not have access to my users .ssh/config data for my key
switched to: