[英]Git migrate repo to another server
我意識到這個問題已經被問過幾次了。 在這里問之前,我經歷了幾乎所有這些問題。
我在服務器A上有一個git repo,並希望它在遠程服務器B上推送。
我遵循的步驟:
在服務器B上:
mkdir repo
cd repo
git init --bare
ls
branches config description HEAD hooks info objects refs
在存在我的本地存儲庫的服務器A上。
cd localrepo
git remote add new-origin root@B:/root/repo
git push new-origin master
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (12/12), 976 bytes | 0 bytes/s, done.
Total 12 (delta 1), reused 0 (delta 0)
To root@172.16.189.221:/root/four
* [new branch] master -> master
現在,當我檢查服務器B時。找不到更新的文件。 每次我在A上的localrepo上更新並推送到B時,它都會更新B中object文件夾下的內容,但看不到文件。
誰能指出我正確的方向:)
裸存儲庫不包含工作樹。 (這就是為什么它被稱為裸露的原因。)因此,您無法直接看到文件。 (您只能看到這些文件,這些文件位於非裸存儲庫中的.git
。)
使用git ls-files
查看存在的文件。 使用git log
查看存在哪些提交。
實際將存儲庫“移動”到另一台服務器,我只會使用
git clone --mirror $original_url
在新服務器上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.