Register to get access to 15+ free programming courses with interactive exercises

Installation and setup Git fundamentals

Git is a fairly complex system with a lot of commands and ways of working. So complex that even experienced developers often have to refer to the documentation and don't know many of its features. On the other hand, git has a kernel, which is sufficient in the vast majority of cases. It affects not only the commands used to work with it, but also some of the ideas that underlie it.

That's what we're going to deal with in this course. However, you should always keep one detail in mind. Git is something that can only be understood by constantly practicing and making mistakes. No one has yet learned how to use git purely by reading the documentation or watching a course.

The goal of this course is to give you the basics and show some primary directions, beyond that, it's all about experimentation. As a rule, git is studied extensively in the first weeks and months after starting a new job, and the process is far from painless. This is because it is almost impossible to simulate the problems that arise in collaborative development during training. In this case, developers who are actively involved in working on open source projects during training are the ones that win. This is the most reliable way to really understand and learn how to master git.

Installation

The way of installing git differs between operating systems. The easiest way to do this is on MacOS and Ubuntu. They allow you to install git through package managers:

# MacOS
# https://brew.sh/
brew install git

# Ubuntu
sudo apt update # just in case, let's look at the new versions
sudo apt install git-all

On Windows, there are lots of options for installing git. The main one is by installing Ubuntu on Windows and then git. This setup may take time, but it's worth it. Ubuntu on Windows adds an environment for developers to work as efficiently and comfortably as possible. In addition, this environment is very similar to the environment in which your projects' code will run.

If your version of Windows does not support the options above, there are several alternatives:

  1. The boldest is to install Ubuntu as the main system. It's very simple
  2. Set up Ubuntu in a virtual machine. It's the safest way, but it requires a fairly powerful computer
  3. Use Git For Windows

After installing git, you should go to the command terminal and check that it works:

git --version

git version 2.28.0
# Your version may be different, but it is important that it is at least 2.23.0

If you have an older version of git installed and are running Ubuntu or Ubuntu on Windows, try the following commands:

sudo apt install software-properties-common
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

After installing git, you need to set it up. It needs to know your name and email address to work. This data will be inserted into the history of changes. This is the only way to find out who did what in the project:

# It runs from any directory
git config --global user.name "<name surname>"
git config --global user.email "<your email>"

Installing the editor

For further work, you need a special code editor. We recommend VSCode. It's currently the most popular (free!) editor, and not only does it have a wide range of features, but also an extensive system of plug-ins, allowing you to buff up your editor significantly.

GitHub account

You will also need to create an account on GitHub, which is a free (for individuals) service where most companies and developers store their projects. It is also used by recruiters to find active and outstanding programmers. They look at the code and assess how popular and complex it is. A GitHub account with high project activity (their own or others') is one of the key elements in employment.

After creating the account, you need to perform one more important operation - adding ssh keys to github.com. In simple terms, the keys allow repositories to work with GitHub without you having to constantly enter your login and password when synchronizing the local and remote repositories (which are on GitHub).

This task is performed in two stages. First, you need to generate ssh keys and then add one of them (the public one) to your GitHub settings. Detailed instructions on how to create ssh keys are available on the website. In a nutshell:

# Creating ssh keys
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
# There will be some questions next. All questions must be answered by pressing Enter

# Running the ssh agent that monitors the keys
eval "$(ssh-agent -s)"

# Adding a new ssh key to the agent
ssh-add ~/.ssh/id_rsa

Once the ssh keys have been created and added to the system, you can start integrating with Github. This procedure is described in detail in the documentation. In a nutshell:

  1. Print the contents of the file ~/.ssh/id_rsa.pub and copy it:

    cat ~/.ssh/id_rsa.pub
    
  2. Add the ssh key to your Github account. When you add it, you will be asked to name a key. Write something like home


Do it yourself

Follow all of the steps in the lesson.


Recommended materials

  1. Installing Ubuntu on Windows
  2. Installing Git on Windows
  3. Installing VSCode on Windows (and integrating with WSL)

Аватары экспертов Хекслета

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs

From zero to a developer. Refunds in case you won't get a job

Frontend Developer icon
Profession
New
Development of front-end components for web applications
start anytime 10 months

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions

Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.