How to Integrate GitHub with PyCharm for Data Science Projects?

Integrate GitHub with PyCharm featured image

It’s obvious for a Data Scientist like you to work on projects with version control. And besides this, you must be using Python language as a major programming language. You know that there are many Python IDEs available in the market for making faster programming. PyCharm is one of them and it’s very popular among programmers. Therefore in this post, you will know how to integrate GitHub with PyCharm in very simple steps.

Step 1: Download the Git Version Control Software

It is an open-source version control software. It is useful for creating version control locally.  Popular companies like Google, Amazon, Netflix, and Facebook are using it.  I will not get into detail to give entire information about GIT. Just download it and install it on your computer. 🙂

Step 2: Make New or Edit Existing Projects

In this step, I will create a new Demo Project and enable version control on it. If you have an existing project you can follow the same process. I created a new Project with the name GitTutorial. It has two Python Script ‘‘ and ‘‘ for tutorial purposes. Now after creating it just follow the steps to enable version control on it.

Go to the menu bar and click on the VCS > Import into Version Control > Create Git Repository. Then it will ask for Folder selection. You can choose your existing folders but I am selecting the newly created Folder GitTutorial.

After selecting the desired Folder, all files inside that folder will turn red.

Before Creating GIT Repository
Files Color Before Creating GIT Repository
Files Color After Creating GIT Repository: Red

What is it mean? It means that all these files are not added to the version control.  To add the files right click on the file and click on Git>Add. After adding the files you will see the file turn green. It means the file has been successfully added to the version control. Similarly, you can add all the existing files.

You can also add all files inside the folder by selecting that folder and click add.

The next thing after adding the files is to finally commit the files. You can commit single or multiple files. Right-click on the folder or a single file and click on Git>Commit File. It will open the window like below.

Commit Changes Git
Commit Window

In the first, you have the option to select or unselect files or Folders. In the commit message, you can put the message( text) in it. For example, I am writing the Initial commit.  At the bottom, you will see the Diff. Here you can see the previous versions of the code ( Any code Changes). After committing all the Files will go back to the default color from Green Color.

Step 3: Integrate Github with PyCharm

All the above steps will lead you to create version control of the project locally. Only local user can add and commit. What if you want to share the code with the other user? Then you will use Github. Github is a cloud version control that is a Cloud repository. Now if you want to integrate Github with PyCharm then follow the process done in this section.

Cloning and Pulling From Github

To integrate Github with PyCharm just go to VCS>Checkout from Version Control and Select Github. It will open up the window like below. Select the authorization type  Password and enter your GitHub username and password.  Select the desired repository URL. Now you can clone and Pull all the Files from that Url.

Pushing to the GitHub

Now the next thing is How to Push the Files created and committed in Step 2 to Github. To do this you have to Push the Files and Folder to the Github URL.  Right-click on the File and Goto Git>Repository and click on Remotes.   It will open up the window. Fill in the Name of the Repository (It can be anything.) and the URL of the repository. In this example, I have added the name as GitTutorial and Github URL. It will check the URL and it will be added if it exists.

Github Remote
Add Github Remote URL here.

Now the final task is to push the files created in step 2 to Github Url. To do this Goto Git>Repository and click on Push. Select the name of the previously added repository (GitTutorial) and click on Push. After some time it will ask for access to Github. Put there your username and password and log in. It will successfully Push all the committed files in Step 2 to your Repository URL.  In the same way, you can pull the changes from GitHub URL by going to Git>Repository and clicking on Pull.

Push to Github
Push to Github

Hurray! You have successfully integrated Github with PyCharm. I hope this article has solved your problem on How to Integrate Github with PyCharm. There are also other version control tools that you can integrate with Pycharm they are Mercurial and Subversion. But Integration with Github is Popular. If you any questions on Github and PyCharm then please contact us. We are always ready to help you. In the meantime, you can subscribe and like our dedicated Page on Data Science.

Other Questions

How to fix a memory error in Pycharm?

Sometimes you got a memory error in Pycharm. If it comes on to your system then you have to modify the pycharm64.exe.vmoptions file that is located in your Pycharm Installation Folder. You have to change the value for -Xmx750m by –Xmx1024m or -Xmx2048m or as per your requirement. Here is the tutorial dedicated to fixing the memory error in Pycharm. It will increase the memory of the Pycharm and solve this issue.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Sukesh ( Chief Editor ), a passionate and skilled Python programmer with a deep fascination for data science, NumPy, and Pandas. His journey in the world of coding began as a curious explorer and has evolved into a seasoned data enthusiast.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner