git / github / gitlab可以检测到该提交发送的操作系统吗?
如果我在Gitlab中有回购。是否可以检测到从中发送提交的操作系统?
还是不可能?
我知道不寻常的要求!我已经谷歌搜索了很多,但是发现很难找到正确的搜索查询。也许有一个git规范会有所帮助。
编辑: 这是雇主要求使用给定的Linux计算机可怕且非常慢的Linux计算机的要求。我希望我可以使用我的个人Windows机器而不会被追踪。
If I have a repo in gitlab. Is it possible to detect the operating system a commit was sent from?
Or is this impossible?
Unusual request I know! I've googled a lot but finding it difficult to find the right search query. Maybe there is a Git spec that would help.
Edit:
This is an employer requirement to use a given linux computer that is awful and terribly slow. I'm hoping I can use my personal windows machine without being traced.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Git不会将OS或版本信息存储在提交中,因此在一般情况下,没有办法知道。
但是,您也许可以使用一些启发式方法来猜测操作系统。例如,如果存储库使用
worktree-insoding = utf-16le-bom
在.gitattributes
中,则可能的文件很可能是在Windows上投入的。同样,如果存在非UTF-8提交编码(这些天往往极为罕见),那么这也可能提供一些指示,因为某些编码在某些平台上比其他平台更为普遍。例如,您可能还可以根据作者或委员会信息猜测,例如,我总是从Linux(或很少是MacOS)机器中提出的。但是,对于大多数项目而言,除了基于其他元数据猜测之外,除了作者或委员会信息之外,没有其他方法可以知道,大多数存储库都没有如此相关的元数据。
同样,GitHub和Gitlab也无法知道这一点,因为不可能确定远程系统正在使用的操作系统,尽管在某些情况下可以登录或提供用户代理和/或SSH横幅用于推动提交的信息,可以根据系统有所不同。但是,这并不能告诉您该提交是在创建哪个系统的,而只能告诉您将其推出的系统,而它们不必是相同的。
Git doesn't store the OS or version information in the commit, so in the general case, there's no way to know.
However, you may be able to use some heuristics to guess the OS. For example, if the repository uses a
working-tree-encoding=UTF-16LE-BOM
in.gitattributes
, it's likely that the file in question was committed on Windows. Similarly, if there's a non-UTF-8 commit encoding (which tends to be extremely rare these days), then that may also provide some indication, since some encodings are more common on some platforms than others. You may also be able to guess based on the author or committer information, knowing, for example, that I always commit from a Linux (or, rarely, macOS) machine.However, for most projects, there isn't any way to know other than by guessing based on other metadata, and other than the author or committer information, most repositories don't have such relevant metadata.
Similarly, GitHub and GitLab have no way of knowing this, either, since it isn't possible to know for certain what OS a remote system is using, although in some cases they may log or provide the user-agent and/or SSH banner information used to push the commit, which can differ based on system. However, that doesn't tell you what system the commit was created on, only what system pushed it, and they don't have to be the same.
不,你为什么要关心?
我可能是在用于Windows应用程序的Linux框上编写代码,但是将该代码从我的旧DOS笔记本电脑推向存储库。
No and why would you even care?
I may be writing code on my linux box that is for a Windows application but pushed that code to the repository from my old Dos laptop.