1

In Version Control with Git by Loeliger, it uses the following command to make a clone repository a bare repository i.e. a repository without a working directory

git clone --bare ~/public_html public_html.git

Is the clone repository created by git clone without --bare a repository with a working directory?

How can I tell if an existing repository has a working directory or not?

Thanks.

Tim
  • 1
  • 141
  • 372
  • 590
  • Simplest way to tell if a git repo is working or bare is to look for the existence of a .git directory inside the repo directory. If it has one, it is not a bare repo - and you will also see the files and directories that you keep in your repo. If the repo is bare, you will not see a .git directory because the repo directory only contains what would have been the contents of a .git directory. – Shadowfen Jul 06 '16 at 21:52

2 Answers2

2

If the directory, after cloning, looks like the project you expect, then it's a working directory. It contains all the git information in the .git subdirectory.

If the directory, after cloning, looks nothing like the project you expect, and instead contains directories like logs, objects, refs and hooks, then it's a bare clone and has no working directory. Everything in there is used only by git. You can't work in that directory without damaging the repository. You would need to (non---bare) clone this repo in order to work with it.

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78
1

taken from this answer

git rev-parse --is-bare-repository 
Community
  • 1
  • 1
Yuri G.
  • 4,323
  • 1
  • 17
  • 32