Guide to Integrating Google Colab with GitHub
Updated January 19, 2026: Content rewritten to reflect the latest development environment.
In this guide, we will explain practical steps to migrate your Python code from Google Colab to a professional development workflow using GitHub and local editors like VSCode or Cursor.
If you have been developing solely on Colab, these steps will help you establish version control with GitHub and a comfortable local editing environment, enabling a more efficient and scalable development process.
- Repository Preparation: Setting up the environment on GitHub.
- Initial Integration: Safely migrating code from Colab to GitHub.
- Local Setup: Configuring modern editors (VSCode, Cursor, etc.).
- Development Workflow: Establishing a daily development cycle.
Current Status and Goalsβ
- Current Status
- Code exists only on Google Colab (.ipynb files)
- GitHub account is ready, but no repository has been created yet
- No code exists in the local environment
- Version control with Git has not been implemented
- Goals
- Manage code history and versions via GitHub
- Enjoy a comfortable editing experience in VSCode, Cursor, or other editors
- Maintain seamless execution and testing on Google Colab
1. Preparing the GitHub Repositoryβ
First, create a "container" (repository) on GitHub to receive the code from Colab.

- Log in to GitHub and click the "+" icon in the top right, then select
New repository. - Enter a
Repository name(e.g.,colab-data-analysis). - Choose
PublicorPrivate. Private is recommended for personal projects. - Under
Initialize this repository with:, checkAdd a README file.- Note: Creating a README automatically generates the
mainbranch, making the Colab integration smoother.
- Note: Creating a README automatically generates the
- Click the
Create repositorybutton.
2. Saving from Colab to GitHub for the First Timeβ
Save your current Colab notebook into the repository you just created.
- Open the target notebook in Google Colab.
- From the menu, select
File>Save a copy in GitHub.

If it's your first time or your session has expired, a popup will appear requesting access for Google Colab to your GitHub account. Click "Authorize googlecolab" to allow the integration.

- Configure the save settings:
- Repository: Select the
your-username/your-repository-nameyou created. - Branch: Select
main. - Commit message: Enter a descriptive message like
Initial commit of notebook from Colab.
- Repository: Select the

- Click
OKto execute the save.
3. Setting Up the Local Development Environmentβ
Now, download (clone) the code from GitHub to your local machine and set up your editor.
Cloning the Repositoryβ
- On your GitHub repository page, click the green
CodeβΌbutton.

- Select the
HTTPStab and copy the URL. - Open your terminal, navigate to the directory where you want to save the project, and run the clone command.
# Navigate to your documents folder (or any preferred location)
cd ~/Documents
# Clone the repository
git clone [COPIED_REPO_URL]
# Enter the cloned directory
cd [REPOSITORY_NAME]
Editor Configuration (VSCode / Cursor)β
While we use VSCode as an example here, the flow is identical for Cursor (the AI-powered editor) or other modern IDEs.
- Open the cloned folder in your editor (Tip: type
code .orcursor .in your terminal). - Install essential extensions for Jupyter Notebook (.ipynb) support:
Python: Language supportJupyter: Required for rendering and running notebooks
- Pro Tip: Managing .ipynb Files in Git
- To see strict text-based diffs for version control, right-click the
.ipynbfile in the explorer >Open With...>Text Editor.
- To see strict text-based diffs for version control, right-click the


This displays the file in its raw JSON format, making it easier to track changes (diffs). When you want to edit or run it as a notebook, simply double-click it to open it in the standard Jupyter interface.
4. Daily Development Workflowβ
From Editing to GitHub Syncβ
-
Edit Code Locally
- Use your favorite editor (VSCode/Cursor, etc.) to implement ideas and take advantage of AI completions.
-
Push Changes to GitHub
- Once editing is complete, use the terminal to push your changes.
git add .
# Example messages: feat(new feature), fix(bug fix), docs(documentation)
git commit -m "feat: add data preprocessing logic"
git push origin main -
Verify/Run on Colab
- Open Colab, go to
File>Open notebook, and switch to theGitHubtab.
- Open Colab, go to

- Select your repository (or search by URL) and open the updated notebook.

Important Best Practicesβ
To maintain a smooth integration and avoid merge conflicts, follow these rules:
1. Always "Sync" Before You Start (Most Important)β
It is easy to forget where you made the last edit. Before starting work in any environment, always pull the latest state from GitHub.
- Starting locally:
- Run
git pull origin mainfirst to get the latest remote changes.
- Run
- Starting on Colab:
- Don't just use an old browser tab. Go to
File>Open notebook>GitHubtab to explicitly re-open the latest commit.
- Don't just use an old browser tab. Go to
2. "Save" When You Finishβ
Once your edits are done, always push your work back to GitHub as a "hand-off."
- Local edits: Don't forget to
git push. - Colab edits: Run
File>Save a copy in GitHub. If you close the browser without doing this, your Colab changes will be lost.
3. Avoid Simultaneous Editingβ
To prevent messy conflicts, do not edit the same file in multiple environments at the same time. Strictly follow the "Push from Local β Open in Colab" or "Save from Colab β Pull to Local" relay.
4. Handling Conflictsβ
If a conflict occurs, it is easiest to resolve it in your local environment (VSCode/Cursor). These editors have built-in conflict resolution tools that allow you to visually compare and choose which changes to keep.
Conclusionβ
By following this setup, you create a powerful development environment that leverages the best of all worlds:
- GitHub: Reliable version control and history.
- Local Editors (VSCode/Cursor): High-speed coding with AI and rich extensions.
- Google Colab: On-demand cloud GPU/TPU resources.
By following these simple operational rules, you can minimize conflict risks while enjoying a flexible and professional development workflow.