The Swiss Army Knife for Remote Python Execution.
Githrun turns GitHub repositories into your personal script library. It allows you to execute remote scripts instantly, install them as local tools, or explore folder structures without the hassle of cloning entire repositories.
New! Githrun is now available as a VS Code Extension. Run scripts directly from your code editor with a single click.
CLI Installation
Githrun is available on PyPI and can be installed via pip. It supports Python 3.9 and newer.
pip install githrun
If you use pipx, you can install it globally to use the CLI anywhere:
pipx install githrun
VS Code Extension Setup
The Githrun extension integrates the power of the CLI directly into Visual Studio Code.
Step 1: Install the Extension
- Open VS Code.
- Go to the Extensions view (Ctrl+Shift+X).
- Search for “Githrun”.
- Click Install.
Step 2: Dependency Check
The extension relies on the Githrun CLI. When you first activate it, it will check if githrun is in your path. If not, it will prompt you to install it via a built-in terminal command.
Quick Start
Choose your preferred way to run scripts.
Using CLI
Run a script from your terminal:
githrun run https://github.com/notamitgamer/githrun/blob/main/test/test_githrun.py
Using VS Code
Open a Markdown file with links, and click the Run with Githrun button that appears above the URL.
VS Code: Smart CodeLens
This is the fastest way to run scripts referenced in your documentation or notes.
How it works: The extension automatically scans your open files (Markdown, Python, or Plaintext). If it detects a valid GitHub or Gist URL that ends in .py, it injects a small “Lens” above the line.
Run with Githrun
https://github.com/notamitgamer/githrun/blob/main/test/test_githrun.py
Simply click Run with Githrun to execute the script in a new integrated terminal window.
VS Code: Command Palette
You can access all Githrun features via the Command Palette (Ctrl+Shift+P).
- Githrun: Run from URL… – Opens an input box where you can paste any GitHub URL to run it immediately.
- Githrun: Run Selected Text – Executes the currently highlighted URL.
- Githrun: Install Githrun CLI – Runs the pip install command for you.
VS Code: Context Menus
If you don’t want to use the CodeLens or Command Palette, simply highlight a URL in your editor:
- Select the URL text (e.g.,
https://gist.github.com/...). - Right-click the selection.
- Choose Githrun: Run Selected Text.
Extension Settings
You can configure the extension behavior in VS Code Settings:
githrun.autoInstallDeps(Boolean): If enabled, the extension appends--auto-installto every command, automatically handling missing Python dependencies for you.
CLI: Remote Execution
The run command is the core of the Githrun CLI. It fetches the raw content of a file and executes it locally.
Supported Sources
- GitHub Repositories: Standard blob URLs.
- GitHub Gists: Direct Gist URLs.
Safety First: Inspection
Before running code from the internet, you should verify it. Use the --inspect flag to print the syntax-highlighted code to your terminal without executing it.
githrun run https://github.com/user/repo/blob/main/script.py --inspect
CLI: Tool Installation
Found a useful script? Turn it into a permanent command-line tool on your system using install.
githrun install https://github.com/user/repo/blob/main/utils.py --name my-util
How it works:
- Downloads the script to
~/.githrun/bin/my-util.py. - Creates an executable shim (
.baton Windows, shell script on Linux/Mac). - You add
~/.githrun/binto your system PATH. - You can now type
my-utilin any terminal window.
CLI: Search & Find
Don’t clone a 1GB repo just to find one file. The find command recursively searches the remote repository tree.
githrun find https://github.com/notamitgamer/adpkg "test"
Interactive Mode: By default, this command displays a list of matches. You can type the number of a result to immediately execute that script.
CLI: Downloading
Githrun can download individual files or recursively download entire directories.
Single File
githrun download https://github.com/user/repo/blob/main/script.py
Recursive Folder
If you provide a tree URL, Githrun detects it and downloads the full folder structure.
githrun download https://github.com/user/repo/tree/main/src --output ./local_src
CLI: Bookmarks
Bookmarks allow you to alias long, complex GitHub URLs to short, memorable names.
Add a Bookmark
githrun bookmark add clean-db https://github.com/user/repo/blob/main/scripts/maintenance/clean_database.py
Run a Bookmark
githrun run clean-db
Authentication
By default, GitHub allows 60 unauthenticated API requests per hour. To increase this limit to 5,000/hr and to access Private Repositories, you need to login.
githrun login ghp_YourPersonalAccessToken...
The token is stored locally in ~/.githrun/config.json and is never sent anywhere except GitHub API endpoints.
Python Library API
Githrun exposes its core logic as a Python library, allowing you to build your own tools on top of it.
# main.py
import githrun
# 1. Search a repository for config files
results = githrun.search_repository("https://github.com/user/repo", "config")
# 2. Execute a remote setup script immediately
exit_code = githrun.execute_remote_code("https://github.com/user/repo/blob/main/setup.py")
Configuration
Githrun stores all its data in your home directory under .githrun.
config.json: Stores your API key and bookmarks.cache/: Stores JSON responses from GitHub API (expiring).bin/: Stores scripts installed viagithrun install.
Contributing
We welcome contributions from the community! Whether it’s a bug fix, new feature, or documentation improvement.
Contact the Developer: If you have questions or want to discuss a major feature, feel free to email:
Steps to Contribute
- Fork the repository on GitHub.
- Clone your fork.
- Create a virtual environment and install dependencies.
- Create a branch for your feature.
- Submit a Pull Request.
Security Policy
We take the security of Githrun seriously. Because this tool executes remote code, we strive to ensure that the execution environment is as predictable as possible.
Reporting Vulnerabilities
If you discover a security vulnerability in Githrun, please DO NOT open a public issue. Instead, please email the developer directly at:
We will review your report and work with you to release a patch as soon as possible.
Code of Conduct
We are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, or similar personal characteristic.
Our Pledge: We pledge to make participation in our project and our community a harassment-free experience for everyone.
Please be kind and courteous. Harassment of any kind will not be tolerated. Participants violating these rules may be banned from the community at the discretion of the maintainers.
License
Githrun is open-source software licensed under the MIT License.
You are free to use, modify, and distribute this software in compliance with the license terms.
© 2026 Amit Dutta (notamitgamer).