GitCode CLI Usage Guide

GitCode CLI is a command-line tool for interacting with the GitCode platform, supporting operations such as uploading and downloading models and datasets. The tool is developed based on OpenMind Hub SDK and configured to connect to GitCode API endpoints.

Features

  • 🔐 User authentication and login management
  • 🔗 Git Integration: Automatically configure Git credentials, support standard Git commands
  • 📁 Support for model and dataset repository creation
  • âŦ†ī¸ Batch upload of files and directories
  • âŦ‡ī¸ Repository content download
  • 🎨 Colored terminal output
  • 📊 Upload/download progress display
  • 🔧 Configuration file management

Installation

Install from Source

git clone https://gitcode.com/gitcode-ai/gitcode_cli.git
cd gitcode_cli
pip install -e .

Install using pip

pip install gitcode

Usage

1. Login

First, you need to log in to the GitCode platform:

gitcode login

The system will prompt you to enter an access token (obtained from the GitCode platform).

🎉 Git Integration Feature: After successful login, the tool will automatically configure Git credential helper, so you can directly use standard Git commands to operate GitCode repositories without entering the token again. The credential helper will automatically obtain your real username from the GitCode API for Git authentication:

# After login, these Git commands will automatically use the saved token
# Support two domain formats
git clone https://gitcode.com/username/repo-name.git
git clone https://hub.gitcode.com/username/repo-name.git
git push origin main
git pull origin main

2. Upload Files

Upload Model

gitcode upload ./your-model-dir --repo-id your-username/your-model-name

Upload Dataset

gitcode upload ./your-dataset-dir --repo-id your-username/your-dataset-name

Upload Single File

gitcode upload ./model.bin --repo-id your-username/your-model-name

3. Download Files

Download to Current Directory

gitcode download your-username/your-model-name

Download to Specified Directory

gitcode download your-username/your-model-name -d ./models/

4. Other Commands

Logout