【问题标题】:changes not reflecting at git server更改未反映在 git 服务器上
【发布时间】:2016-04-17 04:15:34
【问题描述】:

我已安装 Git 并将其配置为 CentOS 中的服务器,并将 Windows 配置为客户端计算机。

然后我做了一个 repo 并尝试推送更改但失败并出现错误updating the current branch in a non-bare repository is denied 并且在谷歌搜索后我知道git config receive.denyCurrentBranch ignore

然后我再次尝试推送更改

  ~/Documents/GitHub/Proj02 (master)
$ git push origin master
Warning: Permanently added '192.168.56.102' (RSA) to the list of known hosts.
git@192.168.56.102's password:
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 229 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
To ssh://git@192.168.56.102:/home/git/Proj02/
   75a8cb9..484d414  master -> master
~/Documents/GitHub/Proj02 (master)

但我无法在远程服务器上看到更改

[git@centos Proj02]$ git config receive.denyCurrentBranch ignore
[git@centos Proj02]$ ls

注意:然后在我没有看到服务器上的更改之后,我在服务器存储库中创建了一个文件夹并推送更改,从标准输出中我看到了我从客户端推送的文件的更改,它们被删除以及最近的更改我被推了提交。

我正在尝试实现一个 Git 服务器。

如何查看我刚刚推送的更改?

【问题讨论】:

    标签: git


    【解决方案1】:

    确保:

    • 你的服务器有 git 2.3+
    • 您已在该服务器上设置:

       git config --global receive.denyCurrentBranch updateInstead
      

    (见“Push to a non-bare Git repository”)

    首先确保您在服务器上的 repo 不是 bare repo

    【讨论】:

    • 谢谢,我会浏览给定的链接。 :)
    • @Raja Sure:确保您的 git 版本(在服务器和客户端上)git client --version
    • 我只安装了最新版本,但在 centos 中我是从源代码编译的,因为 centos 官方 repos 有 1.7 版本。我认为这不是问题
    • @Raja 正如我在答案中提到的那样,您至少需要 git 2.3+ 才能授权推送到非裸仓库。不过,正常的过程(与旧的 1.7 git 兼容)是仅在服务器上创建裸仓库:您可以推送到裸仓库。见htmlpreview.github.io/?https://github.com/sitaramc/…
    • @Raja 当然,使用裸仓库,您不会立即看到文件(因为仓库是裸仓库):您需要再次克隆它以检查更改(提交)已推送
    猜你喜欢
    • 2020-06-20
    • 2020-04-14
    • 1970-01-01
    • 2013-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-10
    相关资源
    最近更新 更多