CLI for downloading all repositories from a specified user.
Project description
git-neko
CLI for downloading all repositories from a specified user.
Installation
Via PyPI (Recommended)
With pip (Basic)
pip install git-neko
With pipx (Isolated)
pipx install git-neko
With uv (Best)
The most efficient way to install or run the uploader.
# Permanent isolated installation
uv tool install git-neko
# Run once without installing
uvx git-neko -u <username>
# Run in scripts or ad-hoc environments
uv run --with git-neko git-neko -u <username> -t <token>
From Source (Development)
# Clone the repository and navigate to it
git clone git@github.com:NecRaul/git-neko.git
cd git-neko
# Install environment and all development dependencies (mandatory and optional)
uv sync --dev
# Install pre-commit hook
uv run pre-commit install
# Optional: Run all linters and type checkers manually
uv run pre-commit run --all-files
# Run the local version
uv run git-neko -e -g
Usage
git-neko acts as a sync tool. If a repo folder doesn't exist, it clones it, if it does, it updates it.
# Download/Sync public repositories with `requests`
git-neko -u <github-username>
# Download/Sync public and private repositories with `requests` (using a token)
git-neko -u <github-username> -t <github-personal-access-token>
# Use 'git clone/pull' instead of 'requests' (preserves history, branches and submodules)
git-neko -u <github-username> -g
# Use 'git' with a token for private repository syncing
git-neko -u <github-username> -t <github-personal-access-token> -g
Environment Variables
You can save your credentials to environment variables to avoid passing them manually in every command.
For persistence, add these exports to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile).
# Set your credentials as environment variables
export GITHUB_USERNAME="NecRaul"
export GITHUB_PERSONAL_ACCESS_TOKEN="ghp_necraul"
# Run using the stored environment variables
git-neko -e
# Run using environment variables with the git engine
git-neko -e -g
# Pass environment variables directly within the command
GITHUB_USERNAME="NecRaul" GITHUB_PERSONAL_ACCESS_TOKEN="ghp_necraul" git-neko -e
Options
-u, --username USERNAME GitHub username to download repositories from
-t, --token TOKEN GitHub personal access token (required for private repositories)
-e, --environment - Use stored environment variables for username and token
-g, --git - Use git engine instead of requests (handles history/branches/submodules)
[!TIP] The
-eand-gflags are a boolean toggle.
Dependencies
- requests: fetch data from the GitHub API and handle downloads.
How it works
The tool determines the appropriate GitHub API endpoint based on your input: it queries https://api.github.com/users/{username}/repos for public profiles or https://api.github.com/user/repos when a token is provided to include private data.
Once the repo list is retrieved, git-neko automates the synchronization process using one of two engines:
- Requests Engine (Default): Fetches the repo as a compressed snapshot. This is fast but does not include history, branches or submodules.
- Git Engine (via
-gor--gitflag): Uses your local git installation to perform a full clone or pull This preserves the complete history, branches and submodules.
The Manual Way
Without this tool, you would need to manually parse JSON responses, manage authentication headers, and write logic to differentiate between new clones and existing updates:
# A simplified version of the logic git-neko automates
# It fetches the name and ssh_url, then loops through them
curl -s -H "Authorization: token $GITHUB_PERSONAL_ACCESS_TOKEN" https://api.github.com/user/repos |
jq -r '.[] | "\(.name) \(.ssh_url)"' | while read -r name ssh_url; do
if [ ! -d "$name" ]; then
git clone --recursive "$ssh_url" "$name"
else
echo "Pulling '$name'..."
git -C "$name" pull --recurse-submodules
fi
done
The git-neko way
- Dynamic API Routing: Automatically identifies the correct GitHub endpoint. It uses
/users/{username}/reposfor public browsing or the authenticated/user/reposfor private access, ensuring you get the full list of repos you have permission to view. - State-Aware Syncing: Instead of a simple download, it checks your local file system. If a repo already exists, it intelligently switches to an "update" mode (using
git pullor overwriting viarequests) to keep your local mirror current. - Hybrid Engine Support:
- Lightweight Mode: Uses
requeststo pull repo snapshots quickly without needinggitinstalled or SSH keys configured. - Developer Mode (
-g): Interfaces directly with your localgitbinary to handle full history, branch tracking, and submodule recursion.
- Lightweight Mode: Uses
- Subprocess Management: Uses
Python'ssubprocessandosmodules to provide a robust bridge between theGitHub APIand your local shell, handling directory navigation and command execution automatically.`
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_neko-1.27.tar.gz.
File metadata
- Download URL: git_neko-1.27.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77ede0d7efdc8ce4f246f68d468c54d34135d8dc0f31a04c26b0291bc86944cb
|
|
| MD5 |
24c7e907cf528ccac36f3a4a01fff242
|
|
| BLAKE2b-256 |
b6b41eba130e7adced1c6de0b775559614206f48b82f6c9593b8fc5a454badc8
|
File details
Details for the file git_neko-1.27-py3-none-any.whl.
File metadata
- Download URL: git_neko-1.27-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbd8e895ceb5f2aeec654f982c69148d75a60f4f9b1fac4af3f5e53fd3c348ff
|
|
| MD5 |
45500c969b9c9381f5923bb798acf651
|
|
| BLAKE2b-256 |
acc0b881fe7cd944d3edc8db3d366d490240798f555d30c59c26380cc15b0c0e
|