3

私がやろうとしているのは、dropboxプロジェクトのローカルクローンを取得するために、変更を加えてからこのプロジェクトにプッシュすることです。

私のPCの仕様は次のとおりです。OsWin8X64、Git-1.7.11

私は次の手順を実行しました:

  1. 元のプロジェクトファイルをDropboxフォルダーにコピーしました
  2. ローカルファイルシステムのDropboxフォルダにあるプロジェクトディレクトリにgitリポジトリを初期化しました
  3. 次に、次のように入力してこのディレクトリのクローンを作成しますgit clone absolute/path/to/the/folder
  4. テストのためだけにファイルにいくつかの変更を加え、コミットしました。すべてうまくいきました。
  5. git push origin masterこのエラーメッセージを取得して入力してこれをプッシュしようとしたとき

ここに画像の説明を入力してください

生のTXTはそのように見えます

$ 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), 322 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare reposit
remote: error: is denied, because it will make the index and work tree incon
ent
remote: error: with what you pushed, and will require 'git reset --hard' to
h
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variabl

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing

remote: error: its current branch; however, this is not recommended unless y
remote: error: arranged to update its work tree to match what you pushed in

remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour,

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse
To F:\Cloud\Dropbox\Web Server\pcand.me
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'F:\Cloud\Dropbox\Web Server\pcand.me'

クリーニングトレースを使用して完全にアンインストールし、3回再インストールしようとしましたが、2〜3回以上の手順を実行しました。何も役に立たなかった

私は何が欠けていますか?

4

1 に答える 1

1

一般に、ベア以外のリポジトリにプッシュすることはお勧めできません。

私がすることは:

空のディレクトリ「/path/ to / bare / repository」を作成しますそのディレクトリを入力し、

git init --bare

これにより、安全にプッシュできるgit構造が初期化されます。ドロップボックスフォルダからファイルをそこに置かないでください。

空のディレクトリ「/path/ to / working/folder」を作成します

ドロップボックスファイルをそこにコピーし、ディレクトリに入り、次のコマンドを入力します

git init
git remote add origin /path/to/bare/repository
git commit -a -m 'Initial commit'
git push origin master

git initコマンドにはパラメーターがないため--bare、これはファイルを表示できる作業フォルダーになります。ファイルを「元の」リポジトリにプッシュした後、ベアリポジトリの内容を確認します。そこには読み取り可能なファイルはなく、gitインデックスのみが見つかります。

于 2012-09-05T01:00:49.850 に答える