问题标签 [git-daemon]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
817 浏览

git - Git 守护进程日志,如何启用它并将日志存储到文件中,例如 /var/log/git.log?

如果您认为这不是 SE 的适当部分,可以在哪里发布这样的问题,请告诉我应该将其放在哪里,我会移动它。

反正。我git daemon在我的 OS X 机器上设置了一个在 launchd 下运行的设备,这是里面的 .plist 文件/Library/LaunchDaemons/

一切都像一个魅力,但守护进程将其信息记录到/var/log/system.log. 有没有办法告诉它将其信息(stdout、stderr)记录到专用文件中,例如/var/log/git.log

编辑:我也尝试将StandardOutPathandStandardErrPath键添加到 .plist,但是这样做会使 launchd 无法启动 git 守护进程,原因我不知道(我在 中看到了Service could not initialize:for git 守护进程/var/log/system.log):

编辑:我编辑了 .plist 文件,守护程序使用此配置(StandardOutPath、StandardErrorPath 似乎也有问题)。这是工作的:

现在,我怎样才能将守护进程的日志重定向到一个像 eg 的文件中/var/log/git.log

0 投票
2 回答
3193 浏览

git - Git 'pre-receive' hook and 'git-clang-format' script to reliably reject pushes that violate code style conventions

Let's immediately start with a scrap of the pre-receive hook that I've already written:

NOTE:
Places with irrelevant code are stubbed with # ....

NOTE:
If you are not familiar with git-clang-format, take a look here.

That hook works as expected, and so far, I didn't notice any bugs, but if you spot any problem or have an improvement suggestion, I'd appreciate any report. Probably, I should give a comment on what's the intention behind this hook. Well, it does check every pushed revision for compliance with code style conventions using git-clang-format, and if any of them does not comply, it will output the relevant diff (the one telling developers what should be fixed) for each of them. Basically, I have two in-depth questions regarding this hook.

First, notice that I perform copy of the remote's (server) bare repository to some temporary directory and check out the code for analysis there. Let me explain the intention of this. Note that I do several git checkouts and git resets (due to for loop) in order to analyze all of the pushed revisions individually with git-clang-format. What I am trying to avoid here, is the (possible) concurrency issue on push access to the remote's (server) bare repository. That is, I'm under impression that if multiple developers will try to push at the same time to a remote with this pre-receive hook installed, that might cause problems if each of these push "sessions" does not do git checkouts and git resets with its private copy of the repository. So, to put it simple, does git-daemon have built-in lock management for concurrent push "sessions"? Will it execute the corresponding pre-receive hook instances strictly sequentially or there is a possibility of interleaving (which can potentially cause undefined behavior)? Something tells me that there should be a built-in solution for this problem with concrete guarantees, otherwise how would remotes work in general (even without complex hooks) being subjected to concurrent pushes? If there is such a built-in solution, then the copy is redundant and simply reusing the bare repository would actually speed up the processing. By the way, any reference to official documentation regarding this question is very welcome.

Second, git-clang-format processes only staged (but not committed) changes vs. specific commit (HEAD by default). Thus, you can easily see where a corner case lies. Yes, it's with the root commits (revisions). In fact, git reset --soft 'HEAD~1' cannot be applied to root commits as they have no parents to reset to. Hence, the following check with my second question is there:

I've tried git update-ref -d 'HEAD' but this breaks the repository in such a way that git-clang-format is not able to process it anymore. I believe this is related to the fact that all of these pushed revisions that are being analyzed (including this root one) do not really belong to any branch yet. That is, they are in detached HEAD state. It would be perfect to find a solution to this corner case as well, so that initial commits can also undergo the same check by git-clang-format for compliance with code style conventions.

Peace.

0 投票
0 回答
280 浏览

windows - 可以从 Windows 推送到“git://”repo 吗?

我有一个 repo(在 Linux 机器上),这个 repo 是通过使用git://协议公开的。
我可以成功地从 Linux 机器克隆、获取和推送到该存储库。
但是从 Windows 机器上只能克隆并从该 repo 中获取。
当我尝试推送时,操作挂起,来自 git daemon 的最后一条消息是
Request receive-pack for '<my_repo_name>'.

git://是否尚未实现可推送协议以从 Windows 使用它?

0 投票
1 回答
451 浏览

git - 带有 LFS 的 git 守护进程?

是否可以git daemon与已设置 LFS 的存储库一起使用?我有一台无法连接到我的公司 VPN(没有 Linux 客户端)的机器,我必须与其共享一个存储库以尝试对我的代码进行 Linux 特定的更改。

我有:

  1. 在 Windows 机器上本地镜像存储库。
  2. 运行git daemon --export-all --enable=receive-pack --reuseaddr(从镜像向上一个目录)
  3. 在 Linux 计算机上为此添加了一个遥控器,克隆,并对使用git lfs track.
  4. 当我尝试git push <remote>返回 Window 机器时,我收到 LFS 错误。

错误:

如果我对 LFS 下未跟踪的文件进行编辑,那效果很好。我假设这是因为 git 也期待 Windows 机器上的某种 LFS 服务器。有没有办法让 LFS 在这种情况下工作,或者这只是不支持git daemon

0 投票
1 回答
214 浏览

git - 如何确定客户端的 SSH 指纹以在 Git 挂钩中使用

我有一个 Gitupdate钩子,它检查正在更新的分支是否是主分支,如果是,则向客户端发送错误消息。我现在想做它,所以只有push我自己制作的大师才能通过。

目前我有两个 SSH 密钥添加到authorized_keys一个用户git。其中一个是我的,我打算添加其他的。我在这里读到:

如果您允许每个人通过公钥身份验证与单个用户(如“git”)连接,您可能必须为该用户提供一个外壳包装器,该外壳包装器根据公钥确定哪个用户正在连接,并设置环境相应地变化。

但是他们没有解释如何做到这一点,我也找不到任何关于如何做到这一点的例子。你如何确定正在 SSH 的机器的指纹?我还考虑过创建一个单独的“git-admin”用户帐户,但裸仓库位于 /home/git 目录中,我想不出如何让两个用户使用相同的 url 推送到同一个仓库。我不能让用户共享同一个主目录,因为那样authorized_keys两者都适用,而且我没有任何方法只为一个而不是另一个设置环境变量。

我的服务器在 FreeBSD 上运行。

关于如何实现我想要做的任何想法?

0 投票
1 回答
1343 浏览

git - git 服务器托管使用 git:// 协议,无法设置 SO_KEEPALIVE,没有这样的文件或目录

我在 Windows 上使用 git 版本 2.12.2。我在 git bash shell 中运行了以下命令:

在另一个 git bash shell 上,在服务的同一台机器上,我尝试git://<host>/foo.git从一个测试仓库推送并得到:

我该怎么做SO_KEEPALIVE才能成功设置?

0 投票
1 回答
17108 浏览

docker - 如何从 docker 容器访问主机的 localhost 127.0.0.1

我在本地主机上托管了 Git 守护程序,即'/usr/bin/git daemon --listen=127.0.0.1 --base-path=/opt'作为systemd服务,我正在尝试从 docker 容器访问它。我没有提到端口,因为我不想将端口暴露给外部网络。

Dockerfile:

但它不起作用,它看起来像在容器内部它试图连接容器的本地主机。

那么如何从 Docker 容器连接主机的本地主机呢?

0 投票
3 回答
825 浏览

git - git daemon over ssh - fatal: protocol error: bad line length character: SSH-

I'm created user "gitproxy" on the server side, added my ssh key to its authorized keys and trying to work with git daemon over ssh:

but have the error: On client side:

On server-side:

Repo is exists. Also I normally enter this server via SSH without a password (so, my ssh key is accepted):

Also, I can get list of branches with git-receive-pack from my desktop (client side):

I checked all the possible fixes that are proposed on stackoverflow. But git daemon still returns the error. I'll be very grateful for any help. Thanks in advance!

0 投票
0 回答
171 浏览

git - git 无法使用 `git daemon` 通过 LAN 克隆

我试图通过 LAN 从另一台 Windows PC 克隆我的 repo。其他关于fatal: read error: Invalid argument没有给我任何解决方案的帖子。

在服务器上

在客户端

请求后服务器什么也没说??这是一个 git 错误吗?请帮忙!也许还有另一种方法可以克隆我的回购。

0 投票
1 回答
46 浏览

git - 中止“git push”-打开 git-daemon-export-ok.19906 失败:在 pathto/gitolite.pm 第 115 行拒绝权限

我正在使用 gitolite,现在我无法将一些更改/新文件推送到存储库。我没有对权限进行任何更改,也没有在 git 脚本上工作。你知道这可能是什么原因吗?

也无法创建新的存储库。Git 将在服务器端创建存储库,但用户无法使用它们(许可)

我没有在许可方面进行任何更改。我希望你有一个想法,我所有的网络研究都没有结果。

亲切的问候,尼尔斯