完整備份 Remote Git Repository

遷移Git 遠端儲存庫

丁叮盯町
1 min readSep 16, 2020

先clone一份裸儲存庫,即一個不包含當前工作目錄的儲存庫

mkdir /Users/{Your_Name}/Documents/mirrorcd /Users/{Your_Name}/Documents/mirrorgit clone --bare username@10.34.70.118:Documents/repo.git

完成後在 mirror 目錄下會有一個 repo.git 的 folder
到該 folder 裡,再 push 到新的 empty repository 即完成。

cd repo.gitgit push --mirror username@10.34.70.120:Documents/newRepo.git

補充:如何建立 empty repository

到欲創建 Git repository 的目錄下,建一個 “xxx.git” 的資料夾

cd /Users/{Your_Name}/Documentsmkdir newRepo.gitcd newRepo.gitgit init --bare

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

丁叮盯町
丁叮盯町

Written by 丁叮盯町

0 Followers

單純的程序猿,想寫些什麼記錄生活、記錄所學

No responses yet

Write a response