昨天我在stackoverflow上发布了一个问题,询问如何从一台计算机克隆Git仓库到另一台计算机,如何从另一台机器上执行'git clone'命令?。
现在我成功地从源(192.168.1.2)克隆了一个Git仓库到目标(192.168.1.1)。
但是当我编辑一个文件后,执行git commit -a -m "test"
和git push
时,在我的目标(192.168.1.1)上出现了这个错误:
git push
hap@192.168.1.2's password:
Counting objects: 21, done.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1010 bytes, done.
Total 11 (delta 9), reused 0 (delta 0)
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error:
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error:
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To git+ssh://hap@192.168.1.2/media/LINUXDATA/working
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'git+ssh://hap@192.168.1.2/media/LINUXDATA/working'
我使用两个不同版本的Git(1.7在远程,1.5在本地机器上)。这可能是一个原因吗?