Skip to content

Instantly share code, notes, and snippets.

@scottsb
Last active February 2, 2016 16:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottsb/a0d55e49ca9d3e8c73c2 to your computer and use it in GitHub Desktop.
Save scottsb/a0d55e49ca9d3e8c73c2 to your computer and use it in GitHub Desktop.
Run Git as Repo Owner
#!/bin/sh
# Execute git commands passed on command line as whatever user owns the current Git repository.
# Script can be substituted 1:1 for git in commands.
# Available under the MIT license.
sudo -u $(stat -c %U $(git rev-parse --git-dir)) git "$@"
@patricknelson
Copy link

Compressed into one very easy to read line!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment