私はこれを持っています:
curl -L "https://github.com/cmtr/cp-go-api/tarball/$commit_id" | tar x -C "$project_dir/"
githubからtarballをダウンロードして既存のディレクトリに抽出したいと思います。問題は、次のエラーが発生することです。
Step 10/13 : RUN curl -L "https://github.com/channelmeter/cp-go-api/tarball/$commit_id" | tar x -C "$project_dir/"
---> Running in a883449de956
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9 100 9 0 0 35 0 --:--:-- --:--:-- --:--:-- 35
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
The command '/bin/sh -c curl -L "https://github.com/channelmeter/cp-go-api/tarball/$commit_id" | tar x -C "$project_dir/"' returned a non-zero code: 2
なぜtarアーカイブではないのか知っている人はいますか?ブラウザでgithub.comにアクセスして次のパターンを入力すると、tar.gzアーカイブがダウンロードされます。
https://github.com/<org>/<repo>/tarball/<sha>
なぜ動作しないのか分かりません。
ベストアンサー1
したがって、資格情報を希望するGithubに帰結します。 2段階認証プロセスがない場合は、カールを使用して次のことができます。
curl -u username:password https://github.com/<org>/<repo>/tarball/<sha>
ただし、2段階認証プロセスの設定がある場合は、Githubアクセストークンを使用し、次のようにgithub.comの代わりにapi.github.comを使用する必要があります。
curl -L "https://api.github.com/repos/<org>/<repo>/tarball/$commit_sha?access_token=$github_token" | tar -xz -C "$extract_dir/"
アクセストークンの内容はここで説明されています。 https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line