Git Clone
An action to copy an existing repository from either remote location or local.
Git Clone Command
git clone URL
URL- Location of repository.
This command establishes a client-server communication channel to clone the code base from the git server.
There are many network protocols used by git servers to communicate with client below are few protocols.
- HTTP
- HTTPS
- SSH
- Plain Git
Secured network protocols are Https[Hypertext Transfer Protocol Secure] and SSH[Secure Shell]. Many git servers like GitHub, GitLab, and Bitbucket. Both protocols are known for service to provide secure and reliable communication.
Here, I have used GitHub as a git server. But the procedure will be similar for other git servers.
Git with HTTPS
overview
- It is a secured version of HTTP, developed to communicate securely. It encrypts the data and sends it over the network. When Hackers intercept communication and still the data, data does not make any sense to Them. HTTPS uses 443 port-number of the endpoints.
Git with HTTPS uses Password based authentication to perform every action on git like push, clone, fetch and pull, etc. You can even set a password in the system as well.
Git with SSH
overview
- SSH provides public key based authentication and encryption. Port Number 22 is used for SSH connection.
The user must have to add an ssh key to the account to clone with ssh URL.
Comparison
- Account Security
- Git with HTTPS: If username and password are stolen by anyone then they can change the password of the account and even delete the repositories. Basically you end up with losing control over the account.
- Git with SSH: If the Private key is stolen then they can push new changes to repositories or delete history of the repositories but can not access the whole git account. We can easily get rid from that by replacing new key.
- Authentication
- Git with HTTPS: Every time a user needs to authenticate via username and password. If a user has two-factor authentication enabled(2FA), then the user needs to use PAT [personal access token] for authentication.
- Git with SSH: We have private and public keys generated in SSH, then public keys are stored on Git Server. If a user wants to do any action in git, the private key stored in the client is matched with the public key stored in the git server. If they match, then without prompting the username and the password user is allowed to do this action.
- Firewall
- HTTPS connections are established using 443 port number while SSH connection are using 22 port number. Sometimes SSH connection is blocked by a firewall.
- Initial Setup
- Git with SSH requires an SSH key stored on the git server. Git with HTTPS does not require any key setup.
According to GitHub git, it is said that HTTPS is slightly faster than SSH in a high latency network.
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments
Please comment here...