1.從原地址克隆一份裸版本庫 到本地電腦
git clone --bare? ssh://用戶名 @服務(wù)器地址 IP域名都行: 服務(wù)器目錄下的 git目錄
git clone --bare? ssh://lwt@jjsx.7caiyoutu.com:/data/depot/shop
2.在新的服務(wù)器上創(chuàng)建新的git
cd /data/depot? 進入git目錄
git init --bare? new_project_name.git 創(chuàng)建新的 git目錄
3. 進入本地的git目錄 以鏡像推送的方式 上傳代碼到新git 服務(wù)器上
git push --mirror? ssh://用戶@ 服務(wù)器地址:git目錄結(jié)構(gòu)
git push --mirror? ssh://lwt@ssodev.laowutong.com.cn: /data/depot/shop.git
4.修改新git服務(wù)器的 git目錄 的所屬組 以及權(quán)限
chmod -R 775 /data/depot/shop.git
chown -R www-data:www-data /data/depot/shop.git
5.刪除本地 git 代碼
6. 直接克隆新git服務(wù)器
git clonessh://lwt@lwtdev.laowutong.com.cn:/data/depot/shop.git
7.查看 歷史記錄 是否存在
git log? 新git服務(wù)器倉庫 遷移完畢