我将在服务器(ubuntu服务器12.04)和本地(ubuntu 12.04)上逐步向您展示我正在做的事情:
服务器:
mkdir foo
cd foo
git init
(顺便说一句。) PWD /家庭/安杰伊/库/富
一切都好: - )。
当地:
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 ...一步一步)。现在我要创建第二个回购。我收到了上述错误。也许这个 是问题吗?我不能创建第二个回购?
答案 0 :(得分:1)