【发布时间】:2011-03-12 14:35:48
【问题描述】:
我刚开始使用 GIT(我来自 cvs),想用 Git 设置类似于 cvs/svn 的东西。我执行了以下步骤:
cd o:/repository
git init
cd <working directory>
git clone o:/repository
我现在创建了一个名为 file.txt 的文件,其中包含一些内容 执行“git status”会列出适当的更改。
然后我做
git add file.txt
git commit file.txt
两者似乎都可以正常工作。
当我这样做时
git push,我收到以下错误:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'o:/repository'
我尝试先进行拉取,并指定推送命令的来源和主变体,但没有奏效。
谁能告诉我我错过了什么。我正在运行 Windows 7 64 位。
附言。我也试过了
git push origin master
我得到以下信息:
Counting objects: 3, done.
Writing objects: 100% (3/3), 251 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
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 O:/repository
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'O:/repository'
【问题讨论】:
-
请注意,Git 2.3.0(2015 年 2 月)允许以更安全的方式推送到非裸仓库:请参阅 my answer below。
标签: git version-control versioning