Gitee — A Domestic Code Hosting Platform for China
Gitee — A Domestic Code Hosting Platform for China
Section titled “Gitee — A Domestic Code Hosting Platform for China”Overview
Section titled “Overview”This section introduces Gitee (also known as “码云”), a code hosting platform based in China that offers functionality similar to GitHub. It is particularly useful for IoT developers working within mainland China, and covers common workflows when using Gitee with the Trae IDE.
After completing this section, you will be able to:
- Create a Gitee repository
- Configure Gitee credentials in Trae IDE
- Use Git credential helpers to store Gitee authentication
- Authenticate with Personal Access Tokens (PAT) on macOS
Prerequisites
Section titled “Prerequisites”Before starting this section, make sure you have:
- Completed the Git Version Control Basics section
- Installed Trae IDE
- (Optional) A Gitee account
What is Gitee?
Section titled “What is Gitee?”Gitee (https://gitee.com) is a code hosting platform launched by OSChina. It provides features similar to GitHub, with several advantages for developers in mainland China:
- Fast access: Servers are located in China — no VPN required
- Free private repositories: The free tier includes private repos
- Domestic cloud integration: Easier integration with Alibaba Cloud, Tencent Cloud, etc.
- Chinese-language UI: Fully localized interface
Note for international readers: If you are outside mainland China, you will likely use GitHub instead. The Git workflows described here apply equally to GitHub — simply replace
gitee.comwithgithub.comin the examples below.
Setting Up a Gitee Repository in Trae
Section titled “Setting Up a Gitee Repository in Trae”Trae IDE supports standard Git operations and can connect to Gitee repositories:
1. Create a Repository on Gitee
Section titled “1. Create a Repository on Gitee”Log in to Gitee → Click ”+” in the top-right corner → New Repository → Fill in name, description, choose public/private → Create.
After creation, you will get a repository URL:
https://gitee.com/your-username/repo-name.git2. Clone the Repository Locally in Trae
Section titled “2. Clone the Repository Locally in Trae”Open the terminal in Trae and run:
git clone https://gitee.com/your-username/repo-name.git
# Or use the "Source Control" panel in Trae → "Clone Repository" → paste the Gitee URL3. Let Trae Automate Git Operations
Section titled “3. Let Trae Automate Git Operations”Trae’s AI features (Agent mode) can automatically perform Git operations including git add, git commit, git push, and git pull.
To enable this, make sure:
-
Git user info is configured:
Terminal window git config --global user.name "Your Name"git config --global user.email "your-email@example.com" -
Gitee credentials are configured (see below)
-
The working directory is a valid Git repository: Trae’s Agent auto-detects this. If not, run
git initorgit clonefirst.
Tip: In Trae’s AI mode, you can use natural language commands like:
- “Commit with message ‘Add temperature sensor driver’”
- “Push to remote”
- “Pull latest changes”
Remembering Gitee Credentials
Section titled “Remembering Gitee Credentials”When using HTTPS, each push/pull requires username and password. Use Git’s credential helper to store them:
macOS Keychain (Recommended)
Section titled “macOS Keychain (Recommended)”git config --global credential.helper osxkeychainAfter configuration, the first git push/git pull will prompt for credentials (use your PAT as the password — see below). Credentials are then saved in the macOS Keychain.
Persistent File Storage (General Solution)
Section titled “Persistent File Storage (General Solution)”# Stores credentials in plaintext — use only on personal machinesgit config --global credential.helper storePer-Domain Configuration
Section titled “Per-Domain Configuration”# Use credential store only for Giteegit config --global credential.https://gitee.com.helper storeAuthenticating with Personal Access Tokens (PAT) on Mac
Section titled “Authenticating with Personal Access Tokens (PAT) on Mac”Since 2022, both Gitee and GitHub no longer support account passwords for HTTPS Git operations. Use a Personal Access Token instead.
1. Generate a PAT on Gitee
Section titled “1. Generate a PAT on Gitee”- Log in to Gitee → Avatar → Settings
- Left menu → Security Settings → Personal Access Tokens
- Click “Generate New Token”
- Add a description (e.g., “Trae IDE development”)
- Select scopes (recommended:
projects,git_hooks,hooks,pull_requests) - Click Submit — copy the token immediately (it is shown only once!)
2. Use PAT for Authentication on Mac
Section titled “2. Use PAT for Authentication on Mac”Option A: HTTPS + PAT
Section titled “Option A: HTTPS + PAT”git push# When prompted:# Username: your Gitee username# Password: paste your PATOption B: Store PAT in Keychain (Recommended)
Section titled “Option B: Store PAT in Keychain (Recommended)”Combined with osxkeychain:
git config --global credential.helper osxkeychain
# Trigger a push, enter PAT when prompted — it will be saved automaticallyecho "test" > test.txtgit add test.txtgit commit -m "Test PAT authentication"git push -u origin mainOption C: SSH Key Authentication (Password-Free)
Section titled “Option C: SSH Key Authentication (Password-Free)”# 1. Generate SSH keyssh-keygen -t ed25519 -C "your-email@example.com"
# 2. View public keycat ~/.ssh/id_ed25519.pub
# 3. Add public key to Gitee: Settings → SSH Keys
# 4. Clone via SSHgit clone git@gitee.com:your-username/repo-name.git
# 5. Verify connectionssh -T git@gitee.comTroubleshooting
Section titled “Troubleshooting”Q1: “remote: The project you were looking for could not be found.”
Section titled “Q1: “remote: The project you were looking for could not be found.””- Cause: Incorrect repository URL or no access
- Fix: Verify the URL and check collaborator permissions
Q2: “Authentication failed”
Section titled “Q2: “Authentication failed””- Cause: Expired PAT or incorrect password
- Fix: Regenerate PAT and update stored credentials
Q3: macOS Keychain prompt keeps appearing
Section titled “Q3: macOS Keychain prompt keeps appearing”- Cause: Expired or corrupted Keychain entry
- Fix: Open Keychain Access app → search
gitee.com→ delete the entry → reconfigure
Q4: Trae AI reports “not a git repository”
Section titled “Q4: Trae AI reports “not a git repository””- Cause: Working directory is not a Git repo
- Fix: Run
git initor clone an existing repository
Summary
Section titled “Summary”| Skill | Key Operations |
|---|---|
| Gitee repository setup | Create account, create repo, get URL |
| Trae auto Git ops | Configure user.name/email, ensure credentials work |
| Remember credentials | Use osxkeychain or other credential helpers |
| Mac PAT authentication | Generate token, store in Keychain, push without password |
| SSH password-free login | Generate key, add to Gitee, clone via SSH |
We provide ESP32 ODM design-to-manufacturing services. From prototype to production — the team behind this tutorial can build it with you.
Talk to us →