Tutorial Using GIT and Connect to Github for Your Project in Pycharm

Sencho Parameswara
5 min readJan 18, 2022

This article will explain a little about what Git, Github is and how to use them because Git and Github are very important tools for developers to understand and use in the professional world.

If you often do teamwork, then you are familiar with VCS. Still, if you are new to the programming world, then one day, you will really need VCS for professional needs. VCS stands for Version Control System, a tool to help someone manage changes in source code over time. The often-used software is called GIT, and it can track every code change in a database or program. So if a program built by a team has a problem, the team can easily track who has changed the program and what has been changed. Therefore, GIT is very important to know. Still, the weakness of git is that it can only be used manually offline in our system.

The current pandemic has made many companies implement work from home to all their employees, which means that all work is done remotely from home, so what happens is that the programmer cannot access the program he is working on because the database is located at the company. Still, thanks to github, people can access the programs they work on. So github is an online platform specifically for developers to put all their source code, do project management, as a social media for developers, and as a version control project or our program for free. And most large companies also put their source code here, and we can see or often call open source like the example of Bitcoin. But keep in mind that only the owner and contributors who are trusted by the project owner can edit the project, so even if you have a project, other people can only see it.

Okay, for the first stage, you download git for windows here https://git-scm.com/download/win select standalone installer. After that install, until it’s finished, then you can create a github account.

Creating a github account is quite easy. You only need to sign up then fill in the requested data, and you already have a github account. After having a github account, the first thing to do is start a project, which means you will create a repository (folder of a project) in your github account. For visibility, you are free whether you want other people to see the project you created, or you can choose private if you don’t want that. My suggestion is that all projects you work on github are made public except projects related to your work to open up opportunities to collaborate with other people interested in your project. To initialize, there are several options that you can choose, and there is an explanation, and click create a repository.

I added gitignore python because we will use python in this repository

After the file name (initial commit), a history of changes can be clicked on in the middle. It will appear in full what changes have been made, if the green color means that an addition has been made if the red color means that the code has been deleted, as in the example image below.

this is someone else’s sample file, not the one we have created

When finished, you open pycharm, and you select get from VCS. There are 2 options to clone our repository in pycharm, namely using HTTPS or SSH. For the HTTPS, you go to your repository, click the green code, select the HTTPS, copy the HTTPS link, and enter it into the URL column.

clone with HTTPS

If you have problems cloning using HTTPS, you can use ssh. The trick is that you open the git program that has been downloaded, then type ssh-keygen. After that, you enter, make sure you remember the folder. After that, you go to the folder and open a file called id_rsa. You copy all the letters. Then you go back to the github repository, click on the green code, and select ssh. If you have never created ssh, you can add a new public key. Then you paste the ssh key that you have copied, and you name it as you like

you already have ssh key on github

If it’s like the picture above, you just copy the ssh written in the green code in your repository. You only need to create an ssh key once after that. You can clone using ssh.

clone with ssh

If you have cloned it, you can start coding in pycharm, connected to github. If you have finished making code changes or creating new files from pycharm, you can commit and push to github. A few tips so that your python system runs well, make it a habit to create a virtual environment in each of your projects.

Here are some meanings in GIT

Repository = file where you store your project results

Commit = record changes made in your project

Clone = retrieve repository from remote

push = send the changes to the repository

Pull = take changes that have been made by others

If you want to get to know me or want to see the projects I’ve worked on, you can check out my blog at www.senchoo.com

--

--