10

では、シナリオは次のとおりです。

  • github でコードをホストする - プッシュ先origin
  • デプロイの場合 - プッシュ先deploy (すべてのサイトが表示されるように www フォルダーにプッシュするフックを持つ bluehost 上の裸のレポ)

2 つの異なる場所で作業しているため、ワークフローは次のようになります。

  • github から最新のものを取得します (変更は別の場所で行われ、前の晩にプッシュされました)
  • ローカルで作業して変更をコミットする
  • (github)にプッシュorigin
  • すべてがうまくいった後、このことがオンラインで必要になるため、マスターはdeploy (bluehost)にプッシュされます

まだ私と一緒に?

これはしばらくの間うまくいきましたが、私にとっては素晴らしいことです

それから私はプールでおしっこをしました

誤ってファイルを bluehost に ftp しました(崇高な sftp が有効になっていました)。最新かつ最高のものを bluehost にプッシュしようとすると、すべてがdeploy最新であるというエラーが表示されます。そのようなエラーが発生し、そのようなファイルはマージ、コミット、またはスタッシュで上書きされます...commit

ローカル リポジトリと git リポジトリはすべてチェックされています。

これを修正するのを手伝ってください。 これをグーグルで検索して、ここで他の投稿を読んでみましたが、すべてが私の問題を解決していないようです。試してみpush --forceましたが無駄でした。

どんなアイデアでも素晴らしいでしょう。それとも、bluehost フォルダー全体を消去して、新しい git リポジトリーからやり直して、再び酢酸を取得する必要がありますか?

編集: gitから出力

C:\xampp\htdocs\www\testingboard>git status
# On branch master
nothing to commit, working directory clean

C:\xampp\htdocs\www\testingboard>git push deploy master
danferth@danferth.com's password:
Everything up-to-date

単一のファイルを編集します (index.php

C:\xampp\htdocs\www\testingboard>git add -A

C:\xampp\htdocs\www\testingboard>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   index.php
#

index.php への変更をコミットします

C:\xampp\htdocs\www\testingboard>git commit -m "added mobile variable to index.p
hp"
[master e0be437] added mobile bariable to index.php
1 file changed, 5 insertions(+)

github にプッシュ (動作)

C:\xampp\htdocs\www\testingboard>git push origin master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 353 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://github.com/danferth/breadBoard.git
9e9f3c1..e0be437  master -> master

プッシュしてデプロイします (ftp された他のファイルもそこにあることに注意してください)

C:\xampp\htdocs\www\testingboard>git push deploy master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 353 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: From /home4/danferth/git/breadboard
remote:    9e9f3c1..e0be437  master     -> origin/master
remote: error: Your local changes to the following files would be overwritten by
merge:
remote:         .sass-cache/6329d896b0dd00f287815f75641600307d9f0023/css_didI.sc
ssc
remote:         _START/pageTitle.php
remote:         assets/custom_css/css_didI.css
remote:         assets/custom_css/css_didI.scss
remote:         content/p_didI.php
remote:         didI.php
remote:         index.php
remote:         template.php
remote: Please, commit your changes or stash them before you can merge.
remote: Aborting
remote: Updating 0dc9e3d..e0be437
To danferth@danferth.com:~/git/breadboard.git
9e9f3c1..e0be437  master -> master

C:\xampp\htdocs\www\testingboard>
4

1 に答える 1

1

デプロイ サーバーで、シェル アクセスを使用して www フォルダー (git repo チェックアウト) に移動します。次にgit status、同期していないファイルのリストを取得するために使用します。次にgit checkout -- <paths>、これらのファイルを git リポジトリから復元するために使用して、同期を取り戻します。git pull次に、サーバー上、またはgit push deployローカルの変更のみができるはずです。

post-commit フックを使用しているため、変更はデプロイ サーバーのベア リポジトリには既に存在していますが、チェックアウトされた www の場所にはまだ存在していません。したがって、git pullウェブサーバーを最新の状態にする必要があります。

于 2013-06-03T23:01:05.203 に答える