Skip to content

Instantly share code, notes, and snippets.

@scottsb
Last active February 2, 2016 16:26
Show Gist options
  • Select an option

  • Save scottsb/a0d55e49ca9d3e8c73c2 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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