Question

I am new in git and I have some doubts: Which is the difference from initializing a repository as personal or as central?

I guess If I establish as central, all members of my team can access it. However, if I initialize as personal, I am the only I can access to it (other members of my team cannot access it). Am I right?

Could someone confirm me if i am right and what is the difference between personal and central repositories in git? and for central repository, what does bare mean?

Was it helpful?

Solution

The non-bare repository is the one developers use - it has a working copy checked out, i.e. the code is directly available.

In case of a bare repository all that's there is the contents of the .git folder. This is great for pushing/pulling to/from the repository but for obvious reasons not suitable to view the code directly or work on the code.

So, when you want to develop stuff you want a non-bare repository. When you want to push to another machine create a bare one there and push to it from your non-bare one. If you use e.g. GitHub you won't create that bare repository manually - you create it on the website (which usually creates a bare one internally and sets up access control) and then setup it as a remote locally (the address of the repository is displayed so you just need to copy&paste it).

OTHER TIPS

I consider the two states to be public and private.

Private.
Private is only for me. It's useful to have my code in the cloud, it's backed up and I can download it to any machine I use.

Public. Public is for sharing with other people ('collaborators') whose keys you've entered in the project.

Git is distributed. If you allow other people to read access your repo, they can fetch/pull directly from you. In that case you don’t even need central repo and master is just what you decide to be.

Bare repo is data that is in your personal .git repository. In your working folder you have actual data (.c files if you are C-programmer) and .git folder with repository that is history and all other data that git needs. Bare doesn’t need "checked out data" so it is just .git files.

Bare repo works same as your personal repo and vice versa. Exception is when it comes to handle with local data, because bare repo doest have it, because it doesnt need it.

There are multiple option on how to organise your repo. In any case each person has local repo.

Remote repositories are all bare, you can have single remote repo or each memeber has own remote repo, that enyone can read at any time. This last one is version that is employed by github, and first option with single remote is centralised repo (SVN like setup)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top