0
我的筆記本電腦上有一個Git存儲庫,而且服務器很遠。Git不會推送我的文件
我這樣做是在服務器上:
$ cd apps
$ mkdir my_beautiful_app
$ git init --bare
在我的筆記本電腦,我這樣做:
$ cd beautiful_app_dir
$ git remote add website [email protected]:apps/my_beautiful_app
$ git push website master
這似乎就像是轉移的東西,所以我認爲這是工作。 但實際上不是。在服務器上的my_beautiful_app
目錄中,我沒有項目文件的跟蹤。現在我有很多的文件和目錄的我沒有了問:
在服務器上:
$ ls ~/apps/my_beautiful_app
branches config description HEAD hooks info objects refs
那麼這是意想不到的。 爲什麼我會得到這種奇怪的行爲?我怎樣才能讓服務器上的目錄與我的本地目錄同步?
編輯:
好吧,我嘗試了同樣的事情,但沒有--bare
選項。下面是我的了:
$ git push website master
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
謝謝,但它不工作或者沒有'--bare'標誌。這些消息非常可怕(請參閱我的編輯)。我很害怕。 –