Search code examples
gitgogs

How can I make use of this git repository folder?


I am rescuing a disk that has a Gogs installation. There's a folder with all the git repos stores, they individually look like this:

drwxr-xr-x. 2 sardaukar 4.0K Jul 29 21:51 branches/
-rw-r--r--. 1 sardaukar   66 Jul 29 21:51 config
-rw-r--r--. 1 sardaukar   73 Jul 29 21:51 description
-rw-r--r--. 1 sardaukar   23 Jul 29 21:51 HEAD
drwxr-xr-x. 2 sardaukar 4.0K Jul 29 21:51 hooks/
drwxr-xr-x. 2 sardaukar 4.0K Jul 29 21:51 info/
drwxr-xr-x. 4 sardaukar 4.0K Jul 29 21:51 objects/
-rw-r--r--. 1 sardaukar   98 Jul 29 21:51 packed-refs
drwxr-xr-x. 4 sardaukar 4.0K Jul 29 21:51 refs/

Is there a way I can salvage this and clone these repos again? I have around 20 of them. Not looking to go back to Gogs, just want to be able to clone these repos again...

Thanks for any help!


Solution

  • What you have rescued is a so-called bare repository which is the content of the hidden .git folder in your clone. Just save this directory on a computer with openssh running, say you save it to ~/repo with ~ being the home of the user user, you can clone with:

    git clone user@<your-computer>:~/repo
    

    your-computer is the computer with the ssh server running, if you clone on the same computer write localhost here.

    EDIT (Thanks to Don Branson): If you are cloning your local machine, you can also write:

    git clone /path/to/repo