Git只推送裸露的存储库? [英] Git push only for bare repositories?

查看:105
本文介绍了Git只推送裸露的存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在外部磁盘上尝试'git push origin master'到远程存储库时,出现git警告,指出在缺省情况下git会拒绝将下一版git拒绝结帐库。在外部磁盘上,我已经检查了项目,并且希望将我在计算机上执行的更改发送给这些重新发布。 'git push origin master'是不是正确的方法?我是否需要在外部磁盘上储存仓库上的git pull ...?所以我不能推动变化,只是拉动它们?只使用裸存储库是不同的?因此,如果我的外部磁盘上的存储库是裸仓库,我可以对其进行更改?我是否理解正确?

When I tried 'git push origin master' to remote repository on my external disk, git warning occured stating that pusing to checkout repository will in next releases of git refused by default. On external disk I have checkouted project and I want to send changes that I did on my computer to these reposiotry. Is 'git push origin master' not the right way? Do I have to 'git pull ...' on repository on my external disk? So I cannot push changes but just pull them? Only working with 'bare' repository is different? So if repository on my external disk was a bare repository I could push changes to it? Do I understand correcly?

推荐答案

仔细阅读警告。新的默认禁止仅限于推送到非裸仓库中的当前签出分支。推送到非裸仓库中的任何其他分支是完全正常的。

Read the warning carefully. The new default prohibition is only on pushing to the currently checked out branch in a non-bare repository. It is perfectly OK to push to any other branch in a non-bare repository.

其原因是推送过程没有直接访问工作树索引和分支头在工作树下被改变。当你随后进入工作树时,看起来工作树已经取消了与真正在开发中的任何改变混合在一起的变化。这使得分离两组变更非常困难。

The reason for this is that the push process has no direct access to the working tree so the index and branch head get changed under the working tree. When you subsequently go to the working tree it looks like working tree has undone the changes pushed mixed in with any changes that were genuinely in development. This makes it very difficult to separate the two sets of changes.

推动其他分行没有这样的缺点。如果需要,您可以转到该存储库并将这些更改合并到检出分支中。

Pushing to other branches has no such downsides. You can then go to that repository and merge those changes into the checked out branch if desired.

这篇关于Git只推送裸露的存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆