Git裸存储库不反映从推进的变化 [英] Git bare repository doesnt reflect changes made from push

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

问题描述

首先,是的,这里有很多话题,这让我感到更加困惑,而不是指出正确的东西。



我的设置是这样的:



远程存储库:Linux / opt / projectFolder



请注意 projectFolder 包含其中的初始文件。



我运行以下命令:

git init --bare < - does not work,似乎我有错误,因为我有一个 config 文件夹,我的项目使用,所以它与git冲突,我不知道如何解决它。



所以我做的是:

 > git init 
> git add。
> git commit -m初始文件
> git --bool core.bare true

现在没有任何错误,现在用于



本地储存库:Win10 C:/ git / projectFolder



我运行:

 > git clone user@192.168.xx.xx:/ opt / projectFolder 

成功克隆存储库,现在我尝试从最初的文件中编辑一些文本文件,然后运行:

 > git add。 
> git commit -m测试提交
> git push

当我检查linux remote repo时,文件上的更改没有反映出来,但是如果我克隆它在其他计算机上的变化反映出来



我做错了什么或缺少什么? 解决方案

您缺少的 裸露存储库没有您需要查看的文件。



git-scm.com/docs 的文档,请参阅这个解释关于 core.bare $ b


core.bare



如果该属性为true,则假定该存储库是裸露的,并且没有与其关联的工作目录。如果是这种情况,需要工作目录的许多命令将被禁用,例如git-add [1]或git-merge [1]。

当创建存储库时,git-clone [1]或git-init [1]会自动猜测设置。默认情况下,以/.git结尾的存储库被假定为不是裸(裸=假),而所有其他存储库被假定为裸(裸=真)。



我不知道您可以将资源库初始化后的资源转换为裸存储库,但它似乎适用于您。



在我看来,你应该得到一个

 ! [remote rejected] master  - > master(分支目前被检出)

错误,但可能取决于 git 版本。






您希望只看到裸的存储库作为提交对象的二进制形式(我不会详谈)



但是一切都在 refs下/ objects / 文件夹。



希望能够解释得很好。


First of all, yes there are a lot of topic out there and it is overwhelming to the point that I get more confused rather than pin-pointing out the right stuff.

For starters, I am learning git and trying to apply it to my first project.

My set up is like this:

Remote Repository: Linux /opt/projectFolder

Note that the projectFolder contains initial files in it.

The following command I run:

git init --bare <-- doesnt work, it seems I am having errors because I have a config folder which my project uses, so it conflicts with the git, i don't know how to fix it.

So what I did is:

> git init
> git add .
> git commit -m"Initial Files"
> git --bool core.bare true

That worked without any errors, now for

Local Repository: Win10 C:/git/projectFolder

I run:

> git clone user@192.168.xx.xx:/opt/projectFolder

it cloned the repository successfully, now I tried to edit some text file from the initial files with it and then i run:

> git add .
> git commit -m"Test commit"
> git push

when I checked the linux remote repo the changes on the files didn't reflected BUT if I clone it on other computers the changes are reflected

What am I doing wrong or missing?

解决方案

The thing you are missing is that a bare repository has no files for you to look at.

From the docs at git-scm.com/docs see this explanation about what the core.bare setting does

core.bare

If true this repository is assumed to be bare and has no working directory associated with it. If this is the case a number of commands that require a working directory will be disabled, such as git-add[1] or git-merge[1].

This setting is automatically guessed by git-clone[1] or git-init[1] when the repository was created. By default a repository that ends in "/.git" is assumed to be not bare (bare = false), while all other repositories are assumed to be bare (bare = true).

I did not know that you can turn a repository post-initialization into a bare repository, but it seems to have worked for you.

In my opinion you should have gotten a

 ! [remote rejected] master -> master (branch is currently checked out)

error, but that might depend on the git version.


The file changes you expect to see only live in the bare repository as commit objects in binary form (I won't go into details)

But everything is there under the refs/ and objects/ folders.

Hope that explains enough.

这篇关于Git裸存储库不反映从推进的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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