I set up etckeeper and added the file /etc/etckeeper/commit.d/60github-push
in order to push the commit to github.
[orschiro@thinkpad etc]$ sudo cat /etc/etckeeper/commit.d/60github-push
#!/bin/sh
set -e
if [ "$VCS" = git ] && [ -d .git ]; then
cd /etc/
git push origin master
fi
However, pushing to github fails as etckeeper tries to push as root. Should the use of sudo not preserve my user account settings for git, including my ~/.ssh keys?
[orschiro@thinkpad etc]$ sudo etckeeper commit "test"
[master de5971c] test
Author: orschiro <orschiro@thinkpad.(none)>
3 files changed, 2 insertions(+), 1 deletion(-)
rename etckeeper/{ => commit.d}/60github-push (100%)
create mode 100644 test
no such identity: /root/.ssh/id_rsa: No such file or directory
no such identity: /root/.ssh/id_dsa: No such file or directory
no such identity: /root/.ssh/id_ecdsa: No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.