How to Set Up and Use Git and GitHub with PyCharm IDE on Windows 11

If you’re coding in PyCharm, you’re already using one of the best Python IDEs out there. But to take your workflow to the next level — and never lose your progress again — it’s time to connect Git and GitHub.

Git helps you track and manage your code changes locally, while GitHub lets you store and share your projects online. Together, they make version control seamless inside PyCharm.

In this guide, we’ll show you how to set up and use Git and GitHub with PyCharm IDE in Windows 11 — from installation to your first commit and push.

What You’ll Need Before You Start

Before setting up Git in PyCharm, make sure you have the following:

  • PyCharm IDE (Community or Professional Edition)
  • Git installed on Windows 11
  • A GitHub account (free or pro — both work)
  • An active internet connection

If you already have Git and GitHub set up, skip ahead to the PyCharm integration section.

Step 1: Install Git on Windows 11

First, you’ll need to install Git locally.

  1. Go to the official Git website: https://git-scm.com/downloads
  2. Click Download for Windows.
  3. Once the installer downloads, run it.
  4. During setup, leave the default options as-is (especially “Git from the command line and also from 3rd-party software”).
  5. Click Next through the steps and finish installation.

Once done, verify Git installation by opening Command Prompt and typing:

git --version

You should see something like:

git version 2.46.0.windows.1

That confirms Git is installed correctly.

Step 2: Configure Git (First-Time Setup)

Before using Git, you’ll need to configure your identity — this tells Git who’s making commits.

In the terminal, run:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

You can verify your configuration with:

git config --list

You should see both your username and email listed.
These will appear next to your commits in GitHub.

Step 3: Open Your Project in PyCharm

Launch PyCharm IDE and open your Python project.

If you don’t have one yet:

  1. Click New Project on the welcome screen.
  2. Choose a directory and name for your project.
  3. Once created, open it in the PyCharm workspace.

Step 4: Enable Version Control (Git) in PyCharm

To connect your project to Git:

  1. Go to the top menu → VCS → Enable Version Control Integration…
  2. In the dialog box, select Git and click OK.

You’ll now see new options appear in the VCS (Version Control System) menu and a Git tab at the bottom of PyCharm.

If your project isn’t already a Git repository, PyCharm will initialize one automatically. You’ll also notice new icons appear beside your files — representing tracked and untracked files.

Step 5: Make Your First Commit in PyCharm

Now that Git is active, let’s make your first commit.

  1. Modify or create a new file in your project (e.g., main.py).
  2. Go to VCS → Commit… or press Ctrl + K.
  3. A commit window will appear showing the files you changed.
  4. Add a commit message — for example: Initial commit: added main.py
  5. Click Commit (or Commit and Push if you’re ready to send it to GitHub).

PyCharm will record your first commit in your local Git repository.

Step 6: Connect PyCharm to GitHub

Now let’s link your GitHub account to PyCharm.

  1. Go to File → Settings → Version Control → GitHub.
  2. Click Add Account → Log In via GitHub.
  3. A browser window will open asking you to authorize PyCharm to access your GitHub account.
  4. Once authorized, PyCharm will show your account listed under GitHub.

Tip: If you use two-factor authentication, make sure to log in via browser instead of manually entering credentials.

Your GitHub account is now connected to PyCharm.

Step 7: Create a Remote Repository on GitHub

Now it’s time to create a place online to store your code.

  1. Go to https://github.com/new.
  2. Enter a repository name (e.g., pycharm-git-demo).
  3. Add a description if you’d like.
  4. Choose Public or Private depending on your needs.
  5. Don’t initialize with a README (PyCharm already has your files).
  6. Click Create Repository.

GitHub will show you a page with your new repository URL — something like:

https://github.com/YourUsername/pycharm-git-demo.git

Copy this URL — you’ll need it in the next step.

Step 8: Add the GitHub Remote Repository in PyCharm

Back in PyCharm:

  1. Open the terminal at the bottom.
  2. Link your local Git repo to the GitHub remote using: git remote add origin https://github.com/YourUsername/pycharm-git-demo.git
  3. Now push your code: git push -u origin master (If you’re using a newer Git version, replace master with main.)

PyCharm will prompt for your GitHub credentials or token if not already connected. Once done, your project will be uploaded to GitHub.

You can verify it by visiting your repository URL in a browser — your code should now appear there!

Step 9: Pull and Push Changes

From here on out, you can manage your GitHub workflow directly inside PyCharm.

  • To push new commits:
    • Go to VCS → Git → Push (or press Ctrl + Shift + K).
  • To pull updates from GitHub:
    • Go to VCS → Git → Pull.
  • To view history:
    • Right-click your project → Git → Show History.

PyCharm visualizes Git operations beautifully, so you can manage branches, commits, and merges with ease — all from the IDE.

Step 10: Clone an Existing GitHub Repository in PyCharm

If you want to clone someone else’s repo or your own from GitHub:

  1. From the PyCharm welcome screen, click Get from VCS.
  2. In the dialog, select Git.
  3. Paste the repository URL (from GitHub).
  4. Choose where to save the project locally.
  5. Click Clone.

PyCharm will automatically pull the code, set up the environment, and open the project for editing.

Step 11: Manage Branches in PyCharm

To work on new features without affecting your main code, you can create Git branches directly in PyCharm.

  1. Go to the Git branch icon at the bottom-right corner.
  2. Click New Branch and name it (e.g., feature-login).
  3. Start coding — your changes will stay isolated in this branch.
  4. When ready, you can merge it back into main or push it to GitHub.

PyCharm even shows branch differences and supports easy conflict resolution.

Step 12: Troubleshooting Common Issues

Here are a few quick fixes for common Git–PyCharm issues:

  • Error: “Git executable not found”
    → Go to File → Settings → Version Control → Git, then set the correct Git path, usually: C:\Program Files\Git\bin\git.exe
  • Authentication failed
    → Log out and reconnect GitHub under Settings → Version Control → GitHub.
  • Changes not tracked
    → Make sure Git is initialized (VCS → Enable Version Control → Git).

Wrapping Up

And that’s it! You’ve successfully learned how to set up and use Git and GitHub in PyCharm IDE on Windows 11.

From here, you can commit, push, pull, clone, and manage your code versioning — all without leaving your IDE. It’s one of the best ways to keep your projects safe, organized, and collaborative. Once you get used to this workflow, you’ll never want to code without Git again.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.