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.
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:
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>"
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.
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 "firstname.lastname@example.org" # 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:
Print the contents of the file ~/.ssh/id_rsa.pub and copy it:
Add the ssh key to your Github account. When you add it, you will be asked to name a key. Write something like home
Follow all of the steps in the lesson.
The Hexlet support team or other students will answer you.
Programming courses for beginners and experienced developers. Start training for free
Our graduates work in companies:
From zero to a developer. Refunds in case you won't get a job
Sign up or sign in
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.