如何“混帐显示”在远程回购? [英] How to "git show" on a remote repo?

查看:103
本文介绍了如何“混帐显示”在远程回购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的git存储库与Microsoft的源服务器功能挂钩,以便调试到我的二进制文件的用户将自动从github.com中拉取源文件。

git show命令会为我提供我需要的正确文件和版本,但由于调试器并未在具有项目源的本地git repo的计算机上运行代码,我需要git show从github而不是本地目录。我想像这样:

  git --no-pager--git-dir = git:// github .com / AArnott / dotnetopenid.gitshow 93e76d5ff529b6c9921a984c3608c150ed4ee7a3 

当--git-dir参数是本地目录这工作正常,但是当它是一个远程位置,它给了我一个错误,如:


致命:不是git存储库:' git://github.com/AArnott/dotnetopenid.git'


什么git命令会将特定文件的特定版本从远程URL位置?

解决方案

不幸的是,git不支持获取单个远程文件。有三种解决方法:


  • 使用git fetch获取远程历史记录,然后从本地对象存储中抓取文件。

  • 使用git archive以标准格式的tar格式获得一个完整的树(例如 git archive --remote = url master:somesubdir )。
  • >
  • 在服务器上安装gitweb或类似的东西,并通过它获取文件。


I'm trying to hook my git repository with Microsoft's Source Server feature such that people debugging into my binary will automatically pull source files down from github.com.

The git show command will get me the right file and version that I need, but since the debugger is not running on a computer with a local git repo of the project source code, I need "git show" to pull from github instead of a local directory. I'm imagining something like this:

git --no-pager "--git-dir=git://github.com/AArnott/dotnetopenid.git" show 93e76d5ff529b6c9921a984c3608c150ed4ee7a3

When the --git-dir argument is a local directory this works fine, but when it's a remote location it gives me an error such as:

fatal: Not a git repository: 'git://github.com/AArnott/dotnetopenid.git'

What git command will pull down a particular version of a particular file from a remote URL location?

解决方案

Unfortunately git does not support fetching individual remote files. There are three workarounds:

  • Use git fetch to get the remote history, then snatch the file from the local object store.
  • Use git archive to get a complete tree (e.g. git archive --remote=url master:somesubdir) in tar format on stdin.
  • Setup gitweb or something like that on the server and get the file through that.

这篇关于如何“混帐显示”在远程回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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