相关疑难解决方法(0)

Git推错误'[远程拒绝]主 - >主(分支当前已检出)'

昨天,我发布了一个关于如何将Git存储库从我的一台机器克隆到另一台机器的问题,如何从另一台机器"克隆"?.

我现在能够成功地将Git存储库从我的源(192.168.1.2)克隆到我的目标(192.168.1.1).

但是,当我对文件,a git commit -a -m "test"和a 进行编辑时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: …
Run Code Online (Sandbox Code Playgroud)

git git-push

943
推荐指数
17
解决办法
44万
查看次数

Bare和非Bare存储库之间的实际区别是什么?

我一直在阅读Git中的裸机和非裸机/默认存储库.我无法理解(理论上)它们之间的差异,以及为什么我应该"推"到一个裸存储库.这是交易:

目前,我是唯一一个在3台不同计算机上工作的人,但是后来会有更多人参与其中,所以我使用Git进行版本控制.我在所有计算机上克隆了裸仓库,当我在其中一台计算机上完成修改后,我提交并将更改推送到裸仓库.从我所读到的,裸存储库没有"工作树",所以如果我克隆裸仓库,我将没有"工作树".

我猜测工作树存储项目中的提交信息,分支等.这不会出现在裸仓库中.因此,对于我来说,使用工作树将提交"推送"到repo似乎更好.

那么,为什么我应该使用裸存储库,为什么不呢?有什么实际区别?我认为,这对于从事项目的更多人来说没有好处.

你做这种工作的方法是什么?建议?

git repository git-bare

188
推荐指数
9
解决办法
8万
查看次数

将更改推送到远程存储库时,此Git警告消息是什么?

描述有点简洁.我只是在我的本地主分支上添加了一个文件并将其推回到远程仓库.知道为什么会这样吗?

warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning: 
warning: You can set 'receive.denyCurrentBranch' configuration variable to
warning: …

git version-control

58
推荐指数
3
解决办法
3万
查看次数

git推送到远程主分支

我有一个远程和本地git存储库.
本地存储库是从远程克隆的.
当我修改本地存储库并提交到主分支时.
然后我运行" git push "到远程存储库.
但它失败并输出以下信息.

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 t
remote: error: 'ignore' or 'warn' …
Run Code Online (Sandbox Code Playgroud)

git

3
推荐指数
1
解决办法
4075
查看次数

Git拉和推不起作用

我从个人git服务器克隆了一个空的存储库.在初始push(push -u origin master)后我得到了一些错误,但我推进了内部.

尝试使用git push显示以下内容:

没有共同的参考,没有指定; 什么也不做.也许你应该指定一个分支,比如'master'.致命:远程端意外挂起错误:未能将某些引用推送到"link-top-repository"

然后我尝试了git push origin master:

Counting objects: 3, done.
Writing objects: 100% (3/3), 218 bytes, 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 …
Run Code Online (Sandbox Code Playgroud)

git

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×5

git-bare ×1

git-push ×1

repository ×1

version-control ×1