0

I have seen git repository in two different ways:

Case I:

I am creating my own git repository using commands as (git init followed by git add and git commit). And here if see my directory contains files/folder with sources and that of .git directory.

Case II:

In another case where i am seeing another git repository with folders something like (branches/, description, hooks/, objects/, refs/, config, HEAD, info/, packed-refs).

Can someone please let me know how to create the git repository as mentioned in case II?

geek
  • 47
  • 1
  • 9
  • 2
    Your description sounds like a so-called "bare" repository. The very short description of a bare repository is that it is one with no work-tree, so that no one can work in it. See http://stackoverflow.com/questions/7632454/how-do-you-use-git-bare-init-repository and http://stackoverflow.com/questions/2199897/how-to-convert-a-normal-git-repository-to-a-bare-one for more. – torek Jan 30 '17 at 05:33

1 Answers1

0

Case II is called 'bare' repository. It can represent e.g. project intended to be hosted on some site or e.g. mirror of other git repository.

To create it, simply:

$ git init --bare

Switch --bare will instruct git to NOT create working directory/tree, and will put content of .git dir in current dir. Instead of --bare you can use also --mirror <url> to set up mirror of other git repo (there are some configuration differences between bare and mirror - look into file config to learn more).

Patryk Obara
  • 1,678
  • 12
  • 18