Skip to content

Commit

Permalink
Merge pull request #308 from mjcheetham/osx-noroot-postinstall
Browse files Browse the repository at this point in the history
Run postinstall and uninstall configure commands as current user
  • Loading branch information
mjcheetham committed Mar 17, 2021
2 parents 8136017 + 2e207e9 commit d1cb371
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/osx/Installer.Mac/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/osx/Installer.Mac/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down

0 comments on commit d1cb371

Please sign in to comment.