fork公共仓库并改为私有
方法二为bustub官方推荐。目前不清楚这两种方法是否有区别,但实际尝试中两种方法中,第一种方法会跳出不明的 pull request,第二种不会。
方法一
- 在 “create a new repository” 页面选择“import a repository”。
- 填上要clone仓库的url和想创建的私有仓库的名称,然后选择“Private”,最后点击“Begin Import”。
- 将该private仓库clone到本地开发后,添加原public仓库作为第二个remote,这便于及时获取公共库后续的更改。
# 查看所有的远程库
$ git remote -v
# 添加远程库,取名为public
$ git remote add public https://github.com/cmu-db/bustub.git
方法二
-
在“create a new repository” 页面中直接创建一个private仓库,如 bustub-private。
-
在本地创建一个原仓库的 bare clone,取名 bustub-public:
$ git clone --bare https://github.com/cmu-db/bustub.git bustub-public
- 将原public仓库 mirror 到我们自己的private方库,这样就将public仓库的所有东西都推到private仓库中:
$ cd bustub-public
# If you pull / push over HTTPS
$ git push https://github.com/student/bustub-private.git master
# If you pull / push over SSH
$ git push git@github.com:student/bustub-private.git master
- 删除本地对public仓库的clone:
$ cd ..
$ rm -rf bustub-public
- 将自己private仓库clone到本地机器:
# If you pull / push over HTTPS
$ git clone https://github.com/student/bustub-private.git
# If you pull / push over SSH
$ git clone git@github.com:student/bustub-private.git
- 添加public库作为第二个remote,这便于及时获取公共库后续的更改。
$ git remote add public https://github.com/cmu-db/bustub.git
- 我们可以查看现有的远程库信息,来确认已经添加好了remote
$ git remote -v
origin https://github.com/student/bustub-private.git (fetch)
origin https://github.com/student/bustub-private.git (push)
public https://github.com/cmu-db/bustub.git (fetch)
public https://github.com/cmu-db/bustub.git (push)

浙公网安备 33010602011771号