Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run postinstall and uninstall configure commands as current user #308

Merged
merged 1 commit into from
Mar 17, 2021

Conversation

mjcheetham
Copy link
Collaborator

In the macOS installer postinstall script we run the configure command to get GCM to configure the current user's credential helper as GCM.

However, the postinstall script is often run as root (because that's how installer works out of the box), meaning although GCM will be writing to the ~/.gitconfig file, it will be doing so from a process running as root.

To avoid having root take ownership of ~/.gitconfig we run sudo -u to run the configure command as the real user (not root).

Also update the uninstall script to do the same thing (run unconfigure as the non-root user).

Fixes #186

In the macOS installer postinstall script we run the `configure` command
to get GCM to configure the current user's credential helper as GCM.

However, the postinstall script is often run as root (because that's how
`installer` works out of the box), meaning although GCM will be writing
to the ~/.gitconfig file, it will be doing so from a process running as
root.

To avoid having root take ownership of ~/.gitconfig we run `sudo -u` to
run the `configure` command as the real user (not root).
@mjcheetham mjcheetham merged commit d1cb371 into git-ecosystem:master Mar 17, 2021
@mjcheetham mjcheetham deleted the osx-noroot-postinstall branch March 17, 2021 14:57
@mjcheetham mjcheetham mentioned this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installing Cask on macOS changes ~/.gitconfig ownership to root
3 participants