In github repository, we can git push
git pull
operations, at the same time, we can commit to the repository through the web UI. It seems that the github repository works as bare repository and working repository at the same time?
However, in git bare repository, we cannot commit directory to the repository.
So, my question is
What's real difference between github repository and git bare repository?
You can think of the Git repositories hosted on GitHub or GitLab as bare repositories, as no local development happens directly on the GitHub or GitLab servers. These are bare Git repos whose sole purpose is to enable the distributed sharing of code.
A bare repository is one that contains nothing but the . git folder; in other words, it has the index but lacks the actual working files. A non-bare repository is what you're used to working with, which includes both the git index and the checked out copy of working files.
A bare Git repository is typically used as a Remote Repository that is sharing a repository among several different people. You don't do work right inside the remote repository so there's no Working Tree (the files in your project that you edit), just bare repository data. And that's it.
what's the difference? Simply put, Git is a version control system that lets you manage and keep track of your source code history. GitHub is a cloud-based hosting service that lets you manage Git repositories. If you have open-source projects that use Git, then GitHub is designed to help you better manage them.
It seems that GitHub repository can work as working repository and bare repository at the same time, does that mean GitHub repository is developed from git bare repository
No, Git repos on GitHub are bare, like any remote repo to which you want to push.
Their web interface shows you a representation of the git repo content, and they might a temporary working tree to modify files directly from the web UI (for their inline edit introduced initially in 2011), but it is their own internal mechanism.
From a client's perspective, you can see those as classic bare repos.
GitHub is a 'social website' that allows users to host their source code there. It gives you multiple ways to edit your source code:
git push
svn commit
Depending on your perspective, you could make all kinds of guesses here:
git
commands, it may seem you're talking to a bare git repo at the other endGitHub provides lots of extra magic to hide the internal details from you. I would guess there are bare git repos at the core. The web interface could either work with a non-bare clone of the original bare repo, or it could have a working tree of the files, and using git commands in the fashion: GIT_DIR=/path/to/bare.git git somecommand
. In reality, it's probably much more complicated than that.
Technically, they don't even need to be using Git repositories underneath. At the core, they could be using SomeSystemXYZ, that implements all the necessary protocols to give the appearance that you're working with a Git or Subversion repository. You can only know how a website really works by looking at their source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With