8

What are some use cases for a bare Git repository?

When should we prefer to use a bare repository and what benefits it gives us?

If I need a repository for sharing with a team and pulling changes from production server should I use a bare Git repository?

Haralan Dobrev
  • 7,617
  • 2
  • 48
  • 66
Sonique
  • 6,670
  • 6
  • 41
  • 60
  • 3
    You'd use a bare repository when you don't plan to directly edit any files in this repository. – Felix Kling Jun 12 '14 at 17:13
  • Example of indirect editing: another repository pushing changes to this repository. – pts Jun 12 '14 at 17:18
  • My use case would be git deployement on a server. I create a bare repository where I push local changes,then I had a post commit hook to the bare repo that will checkout the bare repository and push the code to the app directory of my server.A bit like heroku or openshift deployement. – mpm Jun 12 '14 at 17:36
  • 1
    See also http://stackoverflow.com/a/24115534/6309. – VonC Jun 13 '14 at 05:07

1 Answers1

2

My main use case for a bare Git repository is for a repository I can push my local changes into. It's usually (though not always) on a remote server.

Michael
  • 2,181
  • 14
  • 14