Skip to content

Instantly share code, notes, and snippets.

@rnagle
Created November 25, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnagle/8599f3a6f3de8b3ccd9f to your computer and use it in GitHub Desktop.
Save rnagle/8599f3a6f3de8b3ccd9f to your computer and use it in GitHub Desktop.
Get path to the git conf file for the current repository
#!/bin/bash
function gitconf() {
if [[ -d .git ]]
then
echo ".git/config"
return 0;
fi
if [[ -f .git ]]
then
echo "$(cat .git | awk '{print $2}')/config"
return 0;
fi
echo "Must be run from a git repository"
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment