要求能保留原先的commit记录,应该如何迁移呢? 同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢?
光阴似箭催人老,日月如移越少年。
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.
Check the name of the remote first
Assume your remote is origin, use git remote set_url to change the 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.
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.
4). Delete local code
5). Find the Clone address on the new server GitCafe and clone it locally.
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. . .
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.