[英]How to git cat-file on a remote without having to clone first?
I'm trying to use git to read a file content on a remote without having to first clone the repository (kind of like git cat-file
but from the remote).我正在尝试使用 git 读取远程文件内容,而不必先克隆存储库(有点像
git cat-file
但来自远程)。
For more context on the final goal.有关最终目标的更多背景信息。 There's many repos out there exposing bash scripts we can curl and run locally.
那里有许多 repos 公开了 bash 脚本,我们可以 curl 并在本地运行。 For example
例如
bash -c "$(curl -fsSL raw.github.com/sboudrias/dotfiles/master/bin/dotfiles)"
This works for open source repo on Github since they're public.这适用于 Github 上的开源回购,因为它们是公开的。 But this wouldn't work for either private repos or self-hosted gitlab instances.
但这不适用于私人回购或自托管 gitlab 实例。
Since git SSH authentication is already setup, I'm hoping to find a way to get the content of a file on a remote to run it before the user downloaded a whole clone.由于已经设置了 git SSH 身份验证,我希望找到一种方法来获取远程文件的内容,以便在用户下载整个克隆之前运行它。
This is not possible.这是不可能的。 git commands work within the context of a repository;
git 命令在存储库的上下文中工作; they don't accept repositories as arguments. You have to have a local copy of the repository, and operate the
git cat-file
within that repository to get the file contents with that tool.他们不接受存储库为 arguments。您必须拥有存储库的本地副本,并在该存储库中运行
git cat-file
以使用该工具获取文件内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.