Book Image

Git Best Practices Guide

By : PIDOUX Eric
Book Image

Git Best Practices Guide

By: PIDOUX Eric

Overview of this book

Table of Contents (12 chapters)

Creating a server repository


In the first chapter, we saw how to create a simple local Git repository, but now, it's time to create a server repository that will store and manage the code. Of course, for our example, it will be created by GitLab, but not everyone wants GitLab or GitHub.

Note

A server repository, also called "bare repository", is a Git repository without a working copy.

Git can use four protocols to transport data:

  • Local

  • Secure Shell (SSH)

  • Git

  • HTTP

We will see how and when to use these protocols. We will also distinguish between the pros and cons of each protocol.

For all protocols, we have to create the bare repository by executing these lines on the server's command lines.

Erik@server:~$ mkdir webproject
#Create the folder
Erik@server:~$ cd webproject
#go inside it
Erik@server:~/webproject$ git init --bare 
Initialized empty Git repository in /home/erik/webproject

With these commands, we create a directory web project and initialize an empty Git bare repository.

Local

The local protocol...