准备更换git托管,如何迁移原git仓库
大家讲道理
大家讲道理 2017-04-21 10:56:56
0
7
686

要求能保留原先的commit记录,应该如何迁移呢?
同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(7)
迷茫

Check the name of the remote first

git branch -r

Assume your remote is origin, use git remote set_url to change the address

git remote set-url origin remote_git_address

Replace remote_git_address with your new warehouse address

伊谢尔伦

If you want to copy a source code from another Git hosting service to a new Git hosting server, you can follow the steps below.

1). Clone a bare version repository from the original address, such as originally hosted on GitHub.

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

2). Then create a new project on the new Git server, such as GitCafe.

3). Upload the code to the GitCafe server by image push.

cd project.git

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

4). Delete local code

cd ..

rm -rf project.git

5). Find the Clone address on the new server GitCafe and clone it locally.

git clone git@gitcafe.com/username/newproject.git

This method can retain all the content in the original repository.

巴扎黑

Make sure your local library is up to date and just push to the new remote. . .

Git is distributed, and each repository can be used as a server. . .

大家讲道理
git commit -m "Change repo." # 先把所有为保存的修改打包为一个commit
git remote remove origin # 删掉原来git源
git remote add origin [YOUR NEW .GIT URL] # 将新源地址写入本地版本库配置文件
git push -u origin master # 提交所有代码
黄舟

Organize a branch, and then use the branch to create a new library.

大家讲道理

Like the 4th floor, very convenient. All tags and branches are there

黄舟

Why not try to package the entire directory directly and unzip it on a new machine.
Environment permissions are consistent, that’s fine.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template