concept of bare shared repository in git

I have been facing difficulty in understanding the bare repository . I have read everywhere that a shared repo is a bare repo. Why must it be a bare repo? Can’t it be a normal repo which collaborators clone and then push/pull?

  • Git can't find object
  • how to show the full commit message on the merged branch
  • Does git clone copy all source code?
  • Checking if Git branch exists from within Jenkins Groovy script
  • Open source version control projects for video/music editing
  • Merge a branch, but dont fill gitk with noise BUT dont lie about where it came from
  • how to use git branch to commit my code without affecting mainline code
  • Does git have an “I am an idiot” switch to prevent push -f without a branch?
  • Making Ionic 2 project work after cloning from git
  • What do the egit merge modes mean?
  • How to collaborate on a project with Xcode Storyboards?
  • How to add a file to the last commit in git?
  • One Solution collect form web for “concept of bare shared repository in git”

    It needs to be a bare repo because a not bare repo would have a working tree (meaning a specific version of that repo checked out and with files visible).

    Each time you are pushing to a non-bare repo, you have no guarantee that its working tree will reflect what you are pushing, since by default said working tree will be untouched.
    (Imagine if a push would trigger an update of the working tree: the files would change all of a sudden without any control from users on the receiving end)

    That is why it is simpler to have a bare repo as an upstream repo (one you push to): no working tree to manage/update.

    See more at “all about “bare” repos — what, why, and how to fix a non-bare push”.

    It doesn’t have a checked out tree, so it just does what the “server” notionally does in a centralised VCS — records commits, branches, etc when you push to it, and gives you the latest versions when you clone or pull from it.

    Git Baby is a git and github fan, let's start git clone.