我这几年 Git 在线托管方式是一主一从:Bitbucket + Gitlab,个人各类文档十多个仓库。
后来,Github 被巨硬收购后,对个人免费 Private,我将仓库搞成了一主二从:Github + Gitlab、Bitbucket。
大致的、前些年还能比较正常 Push/Pull,自从一些不可描述的原因之后,一些在线 Git 托管网络不顺畅了,我无法判断是 Git 服务器问题,还是电信光纤、移动光纤的问题。
只能转国内:Gitee、code.aliyun、coding.net 三家,
Gitee 颜值比较直,排除;
coding.net 主打团队,排除;
code.aliyun 个人可用,只是颜值,没得选了,就它。
现在是一主三从:code.aliyun + Github、Gitlab、Bitbucket,外加家里、公司两本地,差不多了。
最近几天测试,速度稳定,后面 “从” 的实在是卡住不动了,就直接 Ctrl + C 终结拉倒下次吧。
主从这些操作不麻烦:
$ git remote -h
usage: git remote [-v | --verbose]
or: git remote add [-t <branch>] [-m <master>] [-f] [--tags | --no-tags] [--mirror=<fetch|push>] <name> <url>
or: git remote rename <old> <new>
or: git remote remove <name>
or: git remote set-head <name> (-a | --auto | -d | --delete | <branch>)
or: git remote [-v | --verbose] show [-n] <name>
or: git remote prune [-n | --dry-run] <name>
or: git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
or: git remote set-branches [--add] <name> <branch>...
or: git remote get-url [--push] [--all] <name>
# 主要是这三个指令,或者可以直接编辑 .git/config 目录
┌------------------------------------------------------------┐
| or: git remote set-url [--push] <name> <newurl> [<oldurl>] |
| or: git remote set-url --add <name> <newurl> |
| or: git remote set-url --delete <name> <url> |
└------------------------------------------------------------┘
-v, --verbose be verbose; must be placed before a subcommand
# 对应 .git/config 目录
[remote "origin"]
url = git@code.aliyun.com:<user-name>/note.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:<user-name>/note.git
url = git@gitlab.com:<user-name>/note.git
url = git@bitbucket.org:<user-name>/note.git
$ git remote -v
origin git@code.aliyun.com:<user-name>/note.git (fetch)
origin git@code.aliyun.com:<user-name>/note.git (push)
origin git@github.com:<user-name>/note.git (push)
origin git@gitlab.com:<user-name>/note.git (push)
origin git@bitbucket.org:<user-name>/note.git (push)