一、建立新仓库
1、从原地址克隆一份裸版本库
git clone --bare https://test@dev.test.com/bitbucket/scm/sup/test.git
2、创建新项目
mkdir /data/git/projects/test/test.git
git init --bare test
3、进入裸版本库,以镜像的方式将代码推送到服务器上
cd test.git
git push --mirror https://test@dev.test.com/bitbucket/scm/test/test.git
4、删除本地代码
rm -rf test.git
5、到新的目录clone远程仓库到本地
git clone --bare https://test@dev.test.com/bitbucket/scm/test/test.git
二、切换.git/config里面的remote_url
git branch -r
git remote set-url origin remote_git_address
第二种切换remote_url的方法更直接,直接更改.git/conf配置文件里的ip地址就行。