diff --git a/src/osx/Installer.Mac/scripts/postinstall b/src/osx/Installer.Mac/scripts/postinstall index 86922a7a5..cb73b07db 100755 --- a/src/osx/Installer.Mac/scripts/postinstall +++ b/src/osx/Installer.Mac/scripts/postinstall @@ -30,7 +30,8 @@ fi mkdir -p /usr/local/bin /bin/ln -Fs "$INSTALL_DESTINATION/git-credential-manager-core" /usr/local/bin/git-credential-manager-core -# Configure GCM for the current user -"$INSTALL_DESTINATION/git-credential-manager-core" configure +# Configure GCM for the current user (running as the current user to avoid root +# from taking ownership of ~/.gitconfig) +sudo -u ${USER} "$INSTALL_DESTINATION/git-credential-manager-core" configure exit 0 diff --git a/src/osx/Installer.Mac/uninstall.sh b/src/osx/Installer.Mac/uninstall.sh index 2657046d0..989ed9956 100755 --- a/src/osx/Installer.Mac/uninstall.sh +++ b/src/osx/Installer.Mac/uninstall.sh @@ -10,9 +10,9 @@ then exit $? fi -# Unconfigure +# Unconfigure (as the current user) echo "Unconfiguring credential helper..." -"$GCMBIN" unconfigure +sudo -u `/usr/bin/logname` "$GCMBIN" unconfigure # Remove symlink if [ -L /usr/local/bin/git-credential-manager-core ]