顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== Git 手動 Mirror 方式 ====== Git 和 SVN 很不同的就是 Git 只要在 server 有權限透過 push 就可將 repo 內所擁有的歷史紀錄整個 mirror 到 Server (歷史紀錄內的 commit user 不在 Server 帳號權限清單內也都 OK) 以下就以一個在 GitHUb 的專案 Mirror 到本地端的 GitLab 專案為例進行說明. - 在本地端的 GitLab 建立新的專案 Exp. https://mygitlab.ichiayi.com/root/trysrvtool.git - 將 GitHub 上的專案 clone 下來 Exp. https://github.com/tryweb/trysrvtool.git - 進入 clone 產生的 trysrvtool 目錄內, 再進入 .git 的目錄 - 開啟 config , 大概會類似以下這樣的內容 <file> [core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [remote "origin"] url = https://github.com/tryweb/trysrvtool.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "develope"] remote = origin merge = refs/heads/develope [branch "master"] remote = origin merge = refs/heads/master [branch "environments"] remote = origin merge = refs/heads/environments </file> - 將 [remote "origin"] 內的 url 改成剛剛建立準備 mirror 過去的 url - https://mygitlab.ichiayi.com/root/trysrvtool.git , 也就如下 <file> : [remote "origin"] url = https://mygitlab.ichiayi.com/root/trysrvtool.git fetch = +refs/heads/*:refs/remotes/origin/* : </file> - 接著透過 git push 的命令就可以將原本在 github repo 上的所有紀錄都 mirror 到 gitlab repo 內 * 如果透過 TortoiseGit 的 push 就要選 Push all branches 並將 Include Tags 打勾, 這樣才能將所有分支與 Tag 都推過去.{{:tech:image_134.png|}} {{tag>git gitlab github}} tech/git_push.txt 上一次變更: 2021/05/13 20:20由 jonathan