我想从github远程存储库导出,而不是克隆它.与svn export类似,我不想用它获取.git文件夹.我可以通过克隆和删除.git文件夹来解决它.我想知道是否有更清洁的方式?
我在某处读到了你可以使用git archive来实现这一点.
但是我收到以下错误..
$ git archive --format=tar --remote=git@github.com:xxx/yyy.git master | tar -xf -
Invalid command: 'git-upload-archive 'xxx/yyy.git''
You appear to be using ssh to clone a git:// URL.
Make sure your core.gitProxy config option and the
GIT_PROXY_COMMAND environment variable are NOT set.
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很棒.谢谢.
我试图找出一个在GitHub上生成构建的单命令进程.
我预计会做的是运行某种命令发布,比如说,make release脚本会构建发布工件,然后以某种方式将其上传到GitHub.
但是,我对如何在GitHub上实际获取发布工件感到很困惑.源代码很棒,但不是每个人都想做自己的构建.:-)
如果我转到https://github.com/wesm/pandas并单击"下载"按钮下载存储库的zip(或tar)存档,我得到的存档的文件名是:
wesm-pandas-0.3.0-93-g1d40e65.zip
Run Code Online (Sandbox Code Playgroud)
我可以看到它wesm-pandas代表项目名称,并0.3.0代表项目版本.
是否93代表该分支上的提交数量?
什么是g1d40e65代表?
我在浏览next.js存储库时注意到这个函数从 GitHub 下载并提取模板,带有 tar:
export async function downloadAndExtractExample(
root: string,
name: string
): Promise<void> {
return await promisePipe(
got.stream('https://codeload.github.com/zeit/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`])
)
}
Run Code Online (Sandbox Code Playgroud)
我在 StackOverflow 上搜索,我只找到了这个:
这是一个解释如何从 GitHub 中提取 tar.gz 的线程,但没有提到“代码加载”子域。它与“api”有什么不同?
使用的好处是什么
git archive master/foo | tar -x -C ~/destination
Run Code Online (Sandbox Code Playgroud)
部署/foo 的副本与仅从工作副本复制
cp foo ~/destination/foo
Run Code Online (Sandbox Code Playgroud)
因此,除非出于某种原因,您不想从 master 中的子目录 foo 复制所有内容(或您碰巧正在处理的任何分支),否则使用 cp 部署到 [destination] 就足够了。