Now that you know how Git works, let’s take a look at its family.

Distributed version control system

Git is a free and open source distributed version control system designed to handle any project, small or large, with agility and efficiency.

Github

GitHub is a hosting platform for open source and private software projects. It is named GitHub because it only supports Git as the only repository format for hosting. It provides space for the user to create a Git repository, store some of the user’s data files or code, etc. So, many great projects are hosted on GitHub, and you can easily pull down a great project and improve it.

GitLab

GitLab is an open source project for warehouse management systems. Using Git as a code management tool, and built on the basis of web services.

Both are Web-based Git repositories. In normal use, GitHub offers both public and private repositories, but you have to pay to use private repositories.

GitLab solves this problem by allowing you to create a private, free repository.

So for the most part, GitLab’s security (private repository) and visibility (the ability to control which projects everyone can access) make it the first choice for a company’s commercial projects. But there won’t be a big difference in operation.

Before distributed, most projects were managed by SVN, which is a centralized version control system. What is the difference between the two?

The difference between centralized and distributed

1. Centralized version control system (CVS,SVN)

There is a central server, when working, using their own computers, need to get the latest version from the central server, and then start working, finished work, and then push their own changes to the central server.

Disadvantages: It can only be used when the network is connected, and the upload speed is slow.

2. Distributed version control systems (most commonly Git)

Distributed version control systems have no central servers, so each person has a complete version library on their computer, and they simply swap each other’s changes, pushing each other’s changes.

Distributed version control systems also usually have a computer that acts as a “central server,” but this server is only used to facilitate the “exchange” of everyone’s changes. Without it, everyone can do just as well, but the exchange of changes is not convenient.

Advantages: High security, no need to network

Understand the SSH protocol

In git basics, we configured a public key for a secret free login, and that was SSH. How does it skip the username and password, but still help Git verify our identity?

1. What is SSH?

Simply put, SSH is a network protocol used for encryption-free remote login between computers.

If a user logs in from a local computer using SSH to another remote computer, we can assume that the login is secure.

Why is it safe?

Even if SSH communication is intercepted, the password is not leaked.

2.GitHub validation process

1. The user stores his/her public key on a remote host.

2. During login, the remote host sends a random string to the user, which is encrypted with the user’s private key, and then sends it back.

3. The remote host decrypts the shell using the public key stored in advance. If the decryption succeeds, the user is proved to be trusted and is directly allowed to log in to shell.

So, we don’t need to input any more information.

Differences between HTTPS and SSH

HTTPS: You can clone the project without extra configuration when you get the URL, but you need to verify the username and password when you push the project.

SSH: The public key of SSH must be configured before clone, and you must be the owner or administrator of this project, but the user name does not need to be entered when it is pushed.

Conclusion:

1.HTTPS facilitates anonymous access and is suitable for open source projects, which can be easily cloned and read by others;

2.SSH is suitable for internal projects of the company. Not everyone can clone the project, and the operator must have the permission of the project, which is relatively safe.