我想找到一种更简单的方法来从私有 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)
但是,当我尝试使用curl
SSH 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)
我尝试了本文中描述的其他一些方法,但无济于事。
有任何想法吗?