1. The main command The main command used is git clone --bare to copy the code bare warehouse git push --mirror to push to the new warehouse
su - git
2、git clone
mkdir -p /data/bak
cd /data/bak
git clone --bare git@旧仓库地址:/data/code/ten.git (旧仓库url)
3. New warehouse and new server
mkdir -p /data/gitserver
cd /data/gitserver
git init --bare ten.git //创建新仓库
cd /data/bak/ten
git push --mirror git@新仓库地址:/data/gitserver/ten.git
So far the migration has been successful
4. Modify the address of the local code warehouse
Modify the .git/conf file in the local code directory and change the url to the new warehouse address git remote -v to see the new warehouse address
Reference: https://www.cnblogs.com/ZhangRuoXu/p/6706530.html