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)
本文作者:Joey-Wang
本文链接:https://www.cnblogs.com/joey-wang/p/16889680.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步