---
title: "迁移Git仓库"
author: "jsntghf"
date: "2017-05-06T16:14:17Z"
tags: []
categories: ["互联网"]
slug: "git"
draft: false
lastmod: "2017-05-06T16:14:17Z"
id: 2372946
url: "https://eric-gao.iteye.com/blog/2372946"
---

1、从原地址克隆一份裸版本库，例如原来托管于GitHub

 

```
git clone --bare git://github.com/username/project.git
```

 

2、到新的Git服务器上创建一个新项目

 

3、以镜像推送的方式上传代码到新服务器上

 

```
cd project.git

git push --mirror git@gitcafe.com/username/newproject.git
```

 

此种方式可以保留原版本库中的所有内容。