无法创建第二个存储库 git



我将逐步向您展示我在服务器(ubuntu服务器12.04)和本地(ubuntu 12.04)上正在做的事情:

服务器:

mkdir foo
cd foo
git init

(顺便说一下。残疾人/home/andrzej/repository/foo

一切都还行:-)。

当地:

mkdir test
cd test
git clone andrzej@192.168.1.20:/home/andrzej/repository/foo
(password)
cd foo
(copy some file - e.g. fake.txt)
git add *
git commit -m "Add fake file"

一切都还行:-)。

现在:

git push origin master
(password)
ERROR :
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1.33 KiB, done.
Total 3 (delta 0), reused 0 (delta 0)
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'.
To andrzej@192.168.1.20:/home/andrzej/repository/foo
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'andrzej@192.168.1.20:/home/andrzej/repository/foo'

我做错了什么?我可以补充一点,前段时间我创建了一个名为"repogit"的存储库只是为了测试,一切都很好。(git init...一步一步)。现在我想创建第二个存储库。我收到上述错误。也许这个问题出在哪里?我无法创建第二个存储库?

原始存储库应该是裸露的,以便您轻松执行此操作。

这意味着它应该已经使用--bare选项初始化:

git --bare init

否则,您可以按照此答案中的说明使现有存储库裸露。

最新更新