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.


4 Answers 4


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/or gitweb, 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.

Since I had shell access to the remote machine I ended up writing a small fabric script that could be run from the terminal to list all remote repositories:


from fabric.api import run, env
from fabric.colors import green 

env.hosts = ['<hostname>'];
env.user = '<user>';
env.password = '<password>';

def lr():
  "Lists all remote repositories"
  print(green("listing remote repos"))
  run('cd /var/git; ls -al')

I can now list all remote repositores by issuing the following command from the terminal:

fab lr
  • 2
    Note that this script assumes the git repositories are located in /var/git. While this is commonly the case, it's not always true. Dec 19, 2018 at 10:34

For your Git, the easiest (dirty) way is to make alias in .bashrc:

alias gitlist="echo 'repository1 repository2 repository3'"   # show your git lists of repository1, 2, 3

then another alias quickly goes to repository1 in you PC:

alias repository1='cd /c/Users/Your_Location_of_repository1'
  • This does not work out-of-the-box when the user creates a new repository.
    – jmizv
    Aug 15, 2023 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .