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'标志。这些消息非常可怕(请参阅我的编辑)。我很害怕。 –