gitmacos

How do I find where my git repository is located?


I'm not sure that when I entered git init that I was in the proper directory, and I'm afraid that I may have created a repository somewhere where I didn't want to. How can I find where I created my git repository?

I'm currently on OSX Mavericks


Solution

  • Use the following command in Terminal:

    find . -type d -name '.git'
    

    This will list all subdirectories named .git in the current directory's subtree, indicative of a Git repository located in the respective parent directory.

    Substitute a directory of interest for ., such as ~ to search your entire home dir.

    Note that if you choose / to search your entire filesystem, you'll get permission-denied errors, unless you run with sudo.