小编Sim*_*one的帖子

如何通过命令行从私有 GitHub 存储库下载文件

我想找到一种更简单的方法来从私有 GitHub 存储库获取文件。

我通过在 GitHub 上创建个人访问令牌来下载文件curl,然后像这样使用它:

curl https://MY_TOKEN@raw.githubusercontent.com/accountName/repoName/branchName/fileName.txt
Run Code Online (Sandbox Code Playgroud)

这对我有用,但是我想知道是否有更简单的方法,也许使用 SSH?我不介意输入 SSH 密码,因为它似乎比创建访问令牌更方便。我已经可以在 GitHub 上成功验证:

$ ssh -T git@github.com
# Attempts to ssh to GitHub
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用curlSSH URL 时,出现以下错误:

curl ssh://git@github.com:accountName/repoName/branchName/fileName.txt
curl: (3) URL using bad/illegal format or missing URL
Run Code Online (Sandbox Code Playgroud)

我尝试了本文中描述的其他一些方法,但无济于事。

有任何想法吗?

ssh download git github curl

2
推荐指数
1
解决办法
6782
查看次数

标签 统计

curl ×1

download ×1

git ×1

github ×1

ssh ×1