> For AI agents: the complete documentation index is available at https://docs.vps.town/llms.txt, the full documentation bundle is available at https://docs.vps.town/llms-full.txt.

# 如何将 GitHub 仓库代码迁移到使用 VPS.Town 搭建的 Gitea 中

:::tip 温馨提示

本文由用户 ([赛博丁真](#)) 撰写，并已加入 `VPS.Town 优秀原创文章激励计划`，本站享有完整版权，未经允许不得转载。

本文已通过 [VPS.Town 社区文章投稿及奖励规则 (试行稿)](https://docs.vps.town/kb/community.md) 审核，并获得 `7 折循环优惠券` 奖励。

:::

:::details 📖 本文目录

[](#引言)[](#vpstown-大盘机)[](#选择右上角号)[](#可选择-github-等平台)[](#public-repo-无需填写-token直接迁移即可)[](#private-repo-迁移教程)[](#github-创建令牌教程)[](#点击右上角头像-settings)[](#往下拉找到-developer-settings)[](#选择-generate-classic-token)[](#把-repo-的权限选上)[](#确认后等待迁移即可)[](#迁移成功的范本)
:::

## 引言

本教程将引导你如何从 GitHub 等第代码托管平台迁移至 VPS.Town 大盘机搭建的自托管 Gitea

`unlock-music` 项目曾经因为 DMCA，被 GitHub 官方下架

![image.png](/assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image.png)

最近 GitHub 也开始屏蔽来自中国大陆 IP 的访问，不难想象后续还会发生什么事情：删除国人的仓库、组织，甚至封号。

而 [VPS.Town](http://VPS.Town) 大盘机抗 DMCA，允许托管该类仓库，没有任何后顾之忧。

### [VPS.Town](http://VPS.Town) 大盘机

:::tip 💡 VPS.Town 大盘鸡解决方案

1. 最多可提供高达 **8TB 大容量存储** 的选项，非常适合存放大量项目代码与文档；
2. 同时也提供 **SSD & HDD** 混合方案，读写速度更快、成本更低；
3. 性价比高，适合个人开发者、小团队进行长期托管部署；
4. 抗 DMCA 版权投诉，可用于一些敏感项目；
5. ⚠️ 其中 1TB 存储大盘鸡续费仅需 260/年或 28.5/月，硬盘一次性买断最低仅需 ¥80/TiB
6. 服务器位于香港，距离大陆近，延迟低，速度快

无 AFF 购买链接：[点我一键直达](https://vps.town/cart/goodsList.htm?fid=3\&gid=1)

:::

## 选择右上角+号

迁移外部仓库

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 1.png>)

### 可选择 github 等平台

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 2.png>)

### public repo 无需填写 token，直接迁移即可

private repo 请接着往下看

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 3.png>)

## private repo 迁移教程

### github 创建令牌教程

#### 点击右上角头像 →settings

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 4.png>)

#### 往下拉，找到 developer settings

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 5.png>)

#### 选择 generate classic token

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 6.png>)

#### 把 repo 的权限选上

如果需要迁移其他内容则需要给令牌更多的权限

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 7.png>)

#### 确认后等待迁移即可

![image.png](</assets/images/how-to-migrate-github-repo-to-gitea-vps-town/image 8.png>)

## 迁移成功的范本

迁移完成后的仓库地址为 `gitea.886663.xyz/agczsz/unlock-music1`（作者自建的实例，不保证长期可以访问），迁移结果可参考上方截图。
