Is there way to list all existing repositories using git?
In order to clone a git repository one must have the name of the repository. When working with many repositories it can be hard to remember all the different names, so now I'm wondering if there is possible to list all existing repositories on the remote server using some git command.
You'd either need Shell access to the machine hosting the git-daemon and see the params used to invoke git-daemon or use the Git Web frontend (Repository browser) called GitWeb.
Also refer this existing question
There is one other way but it needs some assistance of you companies server admins. Git features a browsable web frontend called 'GitWeb' which can be configured to show all projects served by git.
Details are explained in the GitWeb README - the config key of interest is called "GITWEB_PROJECTROOT":
GITWEB_PROJECTROOT The root directory for all projects shown by gitweb. Must be set correctly for gitweb to find repositories to display. See also "Gitweb repositories" in the INSTALL file for gitweb.
Maybe you could have a talk with you admins - gitweb can be a great profit for all developers.
As far as I can tell, this needs to be done on the machine that is running git-daemon. You either need to check the arguments where git-daemon was invoked, or possibly check /etc/inetd.conf
This is heavily dependent on how those repositories are accessed, so there isn't really a simple one-size-fits-all answer:
- If the repos are being served by
git-daemon
and/orgitweb
, you can look at the config to see where it keeps its repos and list the contents of that directory. - If the repos are accessed via ssh, then they can be located anywhere in the filesystem. You should be able to find them by looking for all directories on the system containing a file named
HEAD
(e.g.locate HEAD | grep \/HEAD$
), but this may produce false positives and it will also show any repos which are solely local working directories and are not shared or were cloned from another source. - If the repos are managed by gitlab, they're not in the filesystem at all, so you need to use the gitlab web interface to list them. Note that some repos may be hidden from this list if you don't have permission to access them.