# Git
Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.
# Installation
- Install Git:
sudo apt install git-all
# Authenticate to GitHub
To push and pull code from GitHub you need to have access to the repository from your server or VM. The authentication method you use depends on wether you're installing a server for a client or for yourself / development:
- Generate a new SSH key pair (don't overwrite existing keys, press enter on every step):
# Personal installation
ssh-keygen -t ed25519 -C "<your-email>"
# Client installation
ssh-keygen -t ed25519 -C "sip-<client>-<project>"
- Copy the contents of the public key to your clipboard:
cat ~/.ssh/id_ed25519.pub
Add the SSH public key to GitHub:
Personal installation: add the public SSH key to your GitHub account. (opens new window) Note: the server can access all the repository you have access to.
Client installation: add the public SSH key as deployment key to the repository. (opens new window) Note: the server can only access a single repository.
Configure your Git name and email:
# Personal installation
git config --global user.email "<your-email>"
git config --global user.name "<firstname> <lastname>"
# Client installation:
git config --global user.email "<project>@vanegmond.nl"
git config --global user.name "<project>"