This article will teach us how to set up Git and connect Git with GitHub.
In the programming world exist two popular version control systems:
- Git – distributed version control system.
- SVN – centralized version control system.
We will see how to install Git and use GitHub source code management services for your projects.
- Install Git
For Debian-based distributive/ubuntu, run the command:
sudo apt update && sudo apt install git
For Windows:
- Navigate to the Git for Windows installer and download.
- Follow the instructions provided in the Git Setup wizard screen until the installation is complete.
- Open terminal and type
git --version
to be sure that you successfully installed Git.
For Mac:
Most versions of macOS have Git
installed, if not:
- Navigate to the latest macOS Git Installer and download it.
- Follow the instructions and complete the installation.
- Open terminal and type:
git --version
to be sure that you successfully installed Git.
2. Sign up on GitHub
Visit the GitHub page, sign-up, and create empty repositories there.
As a result, you will see something like this:
3. Generate ssh keys:
ssh-keygen -t rsa -b 4096 -C "example@mail.com"
Press enter and create a passphrase to add an extra layer of security. Again, I recommend you do it. But if you don’t want you can skip it.
This command will create .ssh
folder with id_rsa and id_rsa.pub files. To see it, just run the command below:
ls -a ~/.ssh/
4. Copy content from your id_rsa.pub file:
cat ~/.ssh/id_rsa.pub
5. Add ssh keys to the GitHub:
- Navigate to Settings
- Navigate to SSH and GPG keys
- Add ssh keys
That’s it. You have successfully configured Git and GitHub on your machine.