我正在尝试将gitosis和一个存储库备份到一个备份tarball中,然后在一个空白系统上进行恢复和测试,以确保在服务器完全故障的情况下,我可以让一个新系统快速运行。
我使用以下命令获得这两个目录
git clone --mirror gitosis@localhost:gitosis-admin.git gitosis-backup.repo
git clone --mirror gitosis@localhost:test1.git test1-backup.repo然后再涂上一层
在我干净安装的机器上,我已经提取了tarball并完成了
git clone gitosis-backup.repo gitosis-admin
git clone test1-backup.repo test1进入这两个目录并执行git log会显示历史记录。
但这不是提交给新服务器的。但是做git push master并不起作用,而且它声称是最新的。
但是,任何从我的新服务器进行克隆的尝试都会失败,因为repo实际上不是服务器的一部分。
那么我该如何完成这项工作呢?我一直无法在这个网站或任何其他网站上找到关于恢复指甲的答案。
在VoC的帮助下测试的输出如下所示
mkdir git_restore
cd git_restore
mkdir tarballs
cd tarballs
cp ~/backup/*.tgz
tar -zxf gitosis-admin.repo.tgz
tar -zxf test1-backup.repo.tgz
cd ..
mkdir local_repo
cd local_repo
ssh-keygen
sudo apt-get install gitosis
sudo -H -u gitosis gitosis-init < /home/ian/.ssh/id_rsa.pub
ls /srv/gitosis/git # check that this is not a broken sym link
git clone gitosis@localhost:gitosis-admin
cd gitosis-admin
git log # Has the initialise entry
cd ../..
mkdir restore
cd restore
git clone ../tarballs/gitosis-admin.repo gitosis-admin
git clone ../tarballs/test1-backup.repo test1
cd gitosis-admin
git log # Full log is present
git push gitosis@localhost:gitosis-admin master
To gitosis@localhost:gitosis-admin
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'gitosis@localhost:gitosis-admin'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
git status
# On branch master
nothing to commit (working directory clean)
git fetch
git merge origin master
Already up-to-date. Yeeah!
git push gitosis@localhost:gitosis-admin master
To gitosis@localhost:gitosis-admin
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'gitosis@localhost:gitosis-admin'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.顺便说一句,在git推送中,gitosis@localhost:gitosis admin origin/master似乎是在推送,但是如果我在一个单独的目录中复制gitosis admin,然后做git log,那么我就只有一个初始化条目了。
发布于 2012-09-26 15:11:23
如果您使用ssh地址,如"Setting up git securely and easily using gitosis“中所述,您需要确保gitosis帐户具有您在第一台服务器上拥有的正确~gitosis/.ssh/authorized_keys,以及最初用于克隆gitosis-admin.git存储库的公钥和私钥。
总结一下下面的评论:
在服务器上安装
gitosis-admin存储库gitosis-admin上。发布于 2012-09-27 14:25:09
通过指出(a)在我可以做任何事情之前,我需要初始化gitosis,以及(b)推送工作需要--force命令,VonC解决了这个问题。
https://stackoverflow.com/questions/12589671
复制相似问题