Last Updated:

Configuring Git in Intellij IDEA

Today, we'll look at an easy way to set up Git in Intellij IDEA. By completing this tutorial, you will be able to commit and push changes to the project to your GitHub repository.

1. Intellij IDEA click VCS -> Import into Version Control -> Create Git Repository

In the window that appears, select the root directory of the project and click OK

2. Go to GitHub and create a new repository with the desired name

3. Go to the Changes tab (in the lower left corner of Intellij IDEA) or using the key combination Alt + 9 and right-click on the files called Unversioned Files, then in the context menu that appears, select Add to VCS

4. In the Changes tab, right-click on the Default item and in the context menu that appears, select Commit Changes

5. In the window that appears in the Commit Message department, write an intelligible comment to the commit, tick the files necessary for the commit (or do not touch the marked files at all) and click on the Commit button. Everything, the files are committed to the local repository.

6. Now let's commit to the remote repository (we created it in step 2). To do this, go to the repository page on github, for example: https://github.com/username/reponame, where

username — your github login

reponame is the name of your repository

Now find the HTTPS clone URL block on the repository page and copy the link to the clipboard.

7. Now go to the Terminal tab (in the lower left corner of Intellij IDEA) and write the following commands:

 

8. Now commit to the remote repository:

 

Next, we are asked to enter the login and password from the user on Github - enter and get a successful response to our commit. That's it, the project is committed to a remote repository - go to GitHub and check the result.

Now you can commit and then push in this project using IntelliJ IDEA.