跳到主要内容

CLI User Guide

AtomGit CLI downloads and uploads model and dataset files, and creates repositories. The current tool uses the Hugging Face Hub SDK. Installing the atomgit package provides both the atomgit command and the atomgit_hub Python SDK.

This guide was verified with atomgit 1.0.17. Upgrade before using features such as single-file downloads and revision selection.

Installation and Verification​

We recommend installing in a virtual environment with Python 3.11 or later:

python -m pip install -U atomgit
atomgit --version
atomgit --help

atomgit_hub is an importable module included in atomgit; it does not require a separate installation. The pip install gitcode instruction and gitcode commands in older documentation do not apply to this guide.

If your terminal cannot find the atomgit command, use the same Python environment to run:

python -m atomgit --version
python -m atomgit --help

To install from source, use the official CLI repository:

git clone https://atomgit.com/gitcode-ai/atomgit_cli.git
cd atomgit_cli
python -m pip install -e .

Download Models or Datasets​

Public repositories that do not require access approval can be downloaded without logging in. Private or restricted repositories require an access token with the appropriate read permissions; see the login instructions below.

Copy the repository ID from its page. Preserve the full prefix for mirror repositories, such as hf_mirrors/Qwen/Qwen3-0.6B.

Start with a Single File​

Download a README or configuration file to check access and the destination before downloading larger weights:

atomgit download hf_mirrors/Qwen/Qwen3-0.6B README.md -d ./qwen3-check
atomgit download hf_mirrors/Qwen/Qwen3-0.6B config.json -d ./qwen3-check

The second positional argument is the file path within the repository. In single-file mode, omitting -d saves the file in the current directory. Relative subdirectory paths are preserved.

Download an Entire Repository​

# Download the entire model repository, including weights, to the specified directory
atomgit download hf_mirrors/Qwen/Qwen3-0.6B -d ./models/Qwen3-0.6B

# Without a directory, save to a subdirectory named after the repository
atomgit download your-username/your-model-name

To download a dataset, replace the repository ID with the ID provided on the dataset page.

Select a Revision or Download Again​

# Download a file from a branch or tag; replace main with an existing revision
atomgit download hf_mirrors/Qwen/Qwen3-0.6B config.json --revision main -d ./qwen3-check

# Force the specified file to be downloaded again
atomgit download hf_mirrors/Qwen/Qwen3-0.6B config.json -d ./qwen3-check --force
Argument or optionDescription
REPO_IDFull ID provided on the repository page
FILENAMEOptional file path within the repository; omit to download the entire repository
-d, --directoryLocal destination directory
-r, --revisionBranch or tag; when omitted, the SDK resolves the repository's default branch
--forceForce a new download; otherwise reuse downloaded files and resume where supported

View all options supported by your installed version:

atomgit download --help

Login and Account Management​

Before uploading files, creating repositories, or accessing private repositories, create an access token with the appropriate permissions in your AtomGit account settings, then log in:

atomgit login

Paste the access token at the prompt; input is hidden. Use an access token, not your account password.

# Show the currently logged-in user
atomgit whoami

# Show login status, configuration location, and Git integration status
atomgit config-show

# Clear local login information and remove the configured AtomGit Git credential helper
atomgit logout

Create Repositories and Upload Files​

Replace your-username and the repository names with a namespace and repository you are authorized to use. If the target repository does not exist, create it first:

# Create a model repository
atomgit repo create your-username/my-model --type model

# Create a private dataset repository
atomgit repo create your-username/my-dataset --type dataset --private

Upload a directory or a single file:

# Upload a model directory
atomgit upload ./my-model --repo-id your-username/my-model --message "Upload model"

# Upload a dataset directory with a 1200-second upload timeout
atomgit upload ./my-dataset --repo-id your-username/my-dataset --timeout 1200

# Upload a single file
atomgit upload ./README.md --repo-id your-username/my-model

The upload command's --timeout defaults to 300 seconds. Adjust it for file size and network conditions. Use --type dataset when creating a dataset repository; the upload command selects the target with --repo-id.

Use the Python SDK​

The SDK and CLI share login configuration. This example downloads only the README and configuration file, without the full model weights:

from atomgit_hub import snapshot_download

model_dir = snapshot_download(
"hf_mirrors/Qwen/Qwen3-0.6B",
local_dir="./qwen3-check",
allow_patterns=["README.md", "config.json"],
)
print(model_dir)

Remove allow_patterns to download the entire repository, or pass revision to select a version. For private repositories, run atomgit login first or pass an access token through the SDK's token parameter.

Configuration and Git Integration​

ItemCurrent path or address
CLI / SDK login configuration~/.atomgit/config.json
Hub cache directory~/.cache/atomgit
Default Hub endpointhttps://hub.atomgit.com
Git credential helper~/.atomgit/git-credential-atomgit

The CLI internally sets HF_ENDPOINT to https://hub.atomgit.com; no manual configuration is required. The old OPENMIND_HUB_ENDPOINT variable and ~/.gitcode/config.json are not used by the current tool.

The access token is saved in a local JSON configuration file. Do not commit this file to a repository or share it with others.

If Git is installed, atomgit login attempts to configure a global Git credential helper for atomgit.com and hub.atomgit.com. After successful configuration, HTTPS Git operations on these domains can reuse the token:

# Install Git LFS and initialize it before cloning a model repository with large files
git lfs install
git clone https://atomgit.com/hf_mirrors/Qwen/Qwen3-0.6B.git

CLI / SDK downloads use the Hub API and do not require Git LFS. If Git credential setup fails, check the login output and atomgit config-show. A successful CLI login does not guarantee that the Git credential helper was configured successfully.

Troubleshooting​

ProblemSuggested action
atomgit command not foundActivate the Python environment containing the package, or use python -m atomgit
Cannot import atomgit_hubRun python -m pip install -U atomgit in the same Python environment as your code; restart the notebook kernel after installation if needed
Single-file arguments or --revision are not recognizedUpgrade atomgit, then check atomgit --version and atomgit download --help
401 / 403 responseCheck repository access restrictions, token validity, and read or write permissions; run atomgit login again if needed
404 responseVerify the full repository ID, file path, and revision, including the hf_mirrors/ prefix for mirror repositories
Upload timeoutCheck the network and increase the upload timeout with --timeout
Interrupted downloadCheck the network and available disk space, then retry with the same directory; add --force only when a fresh download is needed