本文将以 Gitee(码云)、系统Windows 11 为例,详细介绍从本地仓库初始化到远程协作的全流程操作
目录
1. 前期准备
1.1 注册与配置 Gitee
- 访问 Gitee 官网 注册账号
- 创建 SSH 公钥(本地操作):
# 生成 SSH 密钥(回车使用默认路径)
ssh-keygen -t ed25519 -C "your_email@example.com"
# 查看并复制公钥
cat ~/.ssh/id_ed25519.pub
1.2 下载、安装、配置客户端
-
Git客户端官网下载地址: Windows
-
安装客户端
- 选择默认编辑器:推荐 VS Code 或 Notepad++
- 调整 PATH 环境:选择 “Git from the command line and also from 3rd-party software”
- 换行符设置:选择 “Checkout Windows-style, commit Unix-style line endings”
- 其他步骤默认即可
-
客户端配置(必要身份配置)
# PowerShell 或 Git Bash(安装完客户端有一般鼠标点击鼠标右键可以看到) 中执行 # 设置全局用户名(提交者名称) git config --global user.name "Your Name" # 设置全局邮箱(与代码平台注册邮箱一致) git config --global user.email "your.email@example.com"
-
生成 SSH 密钥
# PowerShell 或 Git Bash(安装完客户端有一般鼠标点击鼠标右键可以看到) 中执行 ssh-keygen -t ed25519 -C "your_email@example.com" # 密钥保存路径(默认): # C:\Users\你的用户名\.ssh\id_ed25519.pub # 查看并复制公钥 cat ~/.ssh/id_ed25519.pub