Skip to main content
Version: Next

Git + VSCode + Gitee Code Management Guide

This article introduces how to configure Git and use VSCode with Gitee for code management.

1. Install Git​

Download​

Visit the Git official website: https://git-scm.com/download/win

Installation​

Run the installer with default options. After installation, "Git Bash Here" will appear in the right-click menu.

Verify Installation​

git --version

2. Configure Git​

Set User Information​

git config --global user.name "YourUsername"
git config --global user.email "YourEmail@example.com"

Generate SSH Key​

ssh-keygen -t rsa -C "YourEmail@example.com"

Press Enter three times to use defaults. Keys are saved in ~/.ssh/.

View Public Key​

cat ~/.ssh/id_rsa.pub

3. Install VSCode​

Download from: https://code.visualstudio.com/download

VSCode has built-in Git support.

4. Configure Gitee​

Register​

Visit: https://gitee.com

Add SSH Public Key​

  1. Go to "Settings" → "SSH Public Key".
  2. Paste your public key content.
  3. Save.

Create Repository​

  1. Click "+" → "New Repository".
  2. Fill in name and description.
  3. Click "Create".

5. Using Git​

Clone Repository​

git clone git@gitee.com:YourUsername/RepoName.git

Initialize Local Repository​

git init

Associate Remote Repository​

git remote add origin git@gitee.com:YourUsername/RepoName.git

Basic Workflow​

git status          # Check status
git add . # Stage all changes
git commit -m "message" # Commit
git push origin master # Push

Pull Updates​

git pull origin master

6. Using Git in VSCode​

Source Control Panel​

Press Ctrl+Shift+G to open Source Control:

  • View changes
  • Stage changes
  • Commit with message
  • Push and pull

Common Operations​

OperationMethod
StageClick + next to file
UnstageClick - next to staged file
CommitEnter message, click ✓
PushMenu → Push
PullMenu → Pull

Common Git Commands​

CommandDescription
git statusView workspace status
git add .Stage all changes
git commit -m "msg"Commit changes
git pushPush to remote
git pullPull from remote
git logView commit history
git branchView branches
git checkout -b nameCreate and switch branch
git merge nameMerge branch