Sometimes within your development team, you might want to create a new or port an existing local Git repository to a USB drive/stick and share it. In such cases, what you need is to create a bare repository so that all developers can collaborate and push their changes to it.
Due to the distributed nature of the Git version control system, contents cannot be directly edited in the bare repository. The following more or less demonstrates the structure of a bare sharing repository (called sharing repository).
|
|
Instead, users need to clone the bare sharing repository to create a local one (called working repository) with the following familiar structure.
|
|
Having their own copies of the repository, users can now modify contents locally and push changes back to the sharing repository to make changes available to others.
Creating a New Bare Sharing Repository
Creating a new bare repository on your USB drive is as easy as follows:
|
|
Porting an Existing Working Repository
In case you want to create a bare sharing repository based on an existing working one, take the following steps:
|
|
Notice that according to Git documentations “–no-hardlinks” forces the cloning process from a repository on a local filesystem to copy the files under the .git/objects directory instead of using hardlinks.
Testing Your Bare Repository
At this point developers can create their working repository by cloning the bare repository on the USB drive.
|
|