要求能保留原先的commit记录,应该如何迁移呢?
同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢?
迷茫2017-04-21 10:58:56
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
伊谢尔伦2017-04-21 10:58:56
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.
巴扎黑2017-04-21 10:58:56
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. . .
大家讲道理2017-04-21 10:58:56
git commit -m "Change repo." # 先把所有为保存的修改打包为一个commit
git remote remove origin # 删掉原来git源
git remote add origin [YOUR NEW .GIT URL] # 将新源地址写入本地版本库配置文件
git push -u origin master # 提交所有代码
黄舟2017-04-21 10:58:56
Why not try to package the entire directory directly and unzip it on a new machine.
Environment permissions are consistent, that’s fine.