Is there a way in which I can see all the git repositories that exist on my machine? Any command for that?
+5
A:
If you are in Linux find / -name ".git"
, otherwise there is no way, they are standard directories, just use your OS file/folder find program to find .git
named folders.
Arkaitz Jimenez
2010-01-07 14:04:50
On Windows (and I am sure Mac too) you could do something similar... just a search for directories named .git - which is what git uses to store its meta information.
cjstehno
2010-01-07 14:07:03
On Macs, the above command works too. (Unless you're running OS9 or earlier!)
Alex Feinman
2010-01-07 14:46:39
A:
On *nix, this will also find any --bare
repositories.
find / -name "*.git" -type d
gahooa
2010-01-07 14:08:13
Bare repositories don't need to be named `name.git` thats just a convention, that I for example, don't follow.
Arkaitz Jimenez
2010-01-07 14:09:32
+2
A:
On Linux, try this command with root permission:
find / | grep \\.git$
this just searchs every files that end with .git ... you can do it with searching tools in Windows, Linux etc...
Michel Kogan
2010-01-07 14:10:29
There is no point letting `find` output everything then filtering with `grep`. I would rather use `--name "*.git"`
Gregory Pakosz
2010-01-07 14:18:41
@Michel, you start 2 processes and make the first one transmit through a pipe the whole `/` tree for the second to grep, when the first one can do everything and avoid the huge useless IO use. Not a real difference for the user normally, but for big filesystems it might make a difference.
Arkaitz Jimenez
2010-01-07 14:39:34
any way, if you wanna use JUST find command, it's better to use -regex instead of -name ... in this case, use this command:sudo find / -regex '.*\.git'
Michel Kogan
2010-01-07 22:05:32