| 平台 | 免费私有库 | 国内速度 | 社区活跃度 | 特殊功能 |
|---|---|---|---|---|
| Gitee | 5人团队以内免费 | ⚡⚡⚡⚡⚡ 最快 | 🟢 活跃 | GitHub 同步、Pages |
| GitCode | ✅ 无限免费 | ⚡⚡⚡⚡ 快 | 🟢 较活跃 | 与 CSDN 深度集成 |
| Codeup | ✅ 无限免费 | ⚡⚡⚡⚡ 快 | 🟡 一般 | 完整 DevOps 流水线 |
| 腾讯工蜂 | ✅ 无限免费 | ⚡⚡⚡⚡ 快 | 🟡 一般 | 企业级权限管理 |
bash# 1. 查看当前远程地址
git remote -v
# 输出:origin https://github.com/用户名/仓库.git
# 2. 删除原有远程地址
git remote remove origin
# 3. 添加新的远程地址(以Gitee为例)
git remote add origin https://gitee.com/用户名/仓库.git
# 4. 推送
git push -u origin master
bash# 保留 GitHub 远程,新增 Gitee 远程
git remote add gitee https://gitee.com/用户名/仓库.git
# 推送到两个仓库
git push origin master # 推送到 GitHub
git push gitee master # 推送到 Gitee
bash# 设置代理
git config --global http.proxy socks5://127.0.0.1:1080
# 取消代理
git config --global --unset http.proxy
bash# 将 GitHub 链接替换为镜像站
git clone https://github.com.cnpmjs.org/用户名/仓库.git
bash# 生成 SSH 密钥
ssh-keygen -t rsa -C "your_email@example.com"
# 将公钥添加到平台
cat ~/.ssh/id_rsa.pub
从零开始用 Gitee:
bashecho "# 我的项目" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/你的用户名/仓库名.git
git push -u origin master
作为初学者,直接使用 Gitee 完全足够,它的界面和操作与 GitHub 相似,在国内访问无任何障碍。等需要参与国际开源项目时,再考虑 GitHub 的加速方案即可。
本文作者:张京
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!