1

gitosis とリポジトリをバックアップ tarball にバックアップし、空のシステムで復元してテストして、完全なサーバー障害が発生した場合に新しいシステムをすばやく実行できるようにしようとしています。

私は2つのディレクトリを使用しています

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

2 つのディレクトリに移動して git log を実行すると、履歴が表示されます。

しかし、これは新しいサーバーにコミットされていません。しかし、 git push origin master を実行しても機能せず、最新であると主張しています。

しかし、私の新しいサーバーからクローンを作成しようとすると、当然のことながら、レポは実際にはサーバーの一部ではないため、失敗します。

では、どうすれば仕事を終えることができるでしょうか。このサイトや他のサイトで、ギトシスの回復に関する答えを見つけることができませんでした.

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 push gitosis@localhost:gitosis-admin origin/master はプッシュしているように見えますが、別のディレクトリで gitosis-admin のクローンを作成してから git log を実行すると、初期化エントリが得られます。

4

2 に答える 2

1

「 gitosis を使用して git を安全かつ簡単にセットアップする」で説明されているように、ssh アドレスを使用している場合は、gitosis 管理者アカウントに~gitosis/.ssh/authorized_keys、最初のサーバーで持っている権限と、最初に使用した公開鍵と秘密鍵があることを確認する必要があります。gitosis-admin.gitレポをクローンします。

以下のコメントを要約すると:

  • サーバーにgitosisをインストールする
  • あなたのsshデーモンが上記のサーバーで動作していることを確認してください
  • gitosis-adminリポジトリのクローンを作成できる新しいキーを生成します (まだサーバーにあります)。
  • ローカル ワークステーションでバックアップ リポジトリを untar します
  • git push --forcegitosis-admin新しいキーで新しいアカウントを使用して、サーバー上のローカルに戻ります。
于 2012-09-26T07:11:23.123 に答える
0

(a) 何かを行う前に gitosis を初期化する必要があること、および (b) プッシュを機能させるには --force コマンドが必要であることを指摘することで、VonC によって解決されました。

于 2012-09-27T06:25:08.807 に答える