私はちょうどGit
を学んでいるので、私に同行してください。私はローカルでいくつかのコードを書いて、私は今私のリモートサーバ(origin
)にプッシュしたいと思います。私はこのエラーを取得する:Gitを学ぶ:リモートは適切な設定にもかかわらずプッシュを拒否しますか?
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'ssh://[email protected]:2200/home/user'
Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing
リモコンはv 2.4.1
であり、この設定(git config --list
の出力)を持つ:
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
receive.denycurrentbranch=updateInstead
い私は上げずconfictsをオーバーライドするために許されるべきではない最後の平均エラー?
私は基本的に最も簡単な設定を探しています。私はサーバー上で開発することはなく、私はアクセスできる唯一の人です。だから、開発マシンが勝つためにプッシュするものは何でもします。
this answerは、リモートのリポジトリを裸にすることを見ましたが、指示はフォルダ内のすべてを削除することでしたが、.git
です。私のプロジェクトの一部ではないそこにファイルがあるので、それは私のために動作しませんが、私は、リモートリポジトリにログインした場合
を移動し、私が見git status
実行しないことを
Untracked files: (use "git add ..." to include in what will be committed)
...(long list of files)
nothing added to commit but untracked files present (use "git add" to track)
私はちょうどでした補遺
:
$ git push --force origin master
stdin: is not a tty
Counting objects: 3801, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3674/3674), done.
Writing objects: 100% (3801/3801), 6.95 MiB | 37.00 KiB/s, done.
Total 3801 (delta 2450), reused 0 (delta 0)
error: Untracked working tree file 'cacert.pem' would be overwritten by merge.
To ssh://[email protected]:2200/home/user
! [remote rejected] master -> master (Could not update working tree to new HEAD)
error: failed to push some refs to 'ssh://[email protected]:2200/home/'
私はちょうどそれ自体を削除することができます思っていますそのファイルのrverのコピーをもう一度やり直してください。 2つのファイルは(それがコピー/ペースト仕事だった)と同じ内容を持つ
omg私はあなたの最初のコマンドを実行し始めました - 私たちが話しているように動いていて、編集後に編集していたことに気付きました。 lol – BeetleJuice
私の元のコマンドよりもかなり混雑していましたが、 '--force'でも動作しませんでした。私はOPで結果を更新しました。 – BeetleJuice
@BeetleJuice Novelie:リモートのリポジトリには、reflogにコミットの古い履歴が残っています。何も失われません。 – VonC