When users want to clone private GitHub repository in Dockerfile, they have to add a deploy key with an access to the private repository with
RUN command to
git clone a private repository within a build.
One solution is using HTTPS instead of SSH when pulling from Github. A user needs to authenticate herself with an OAuth token which can be obtained from Github's admin console. The pull command should look something like this:
git clone https://your_username:<your_token>@github.com/your_repo/your_git_file.git --branch=your_branch clone_folder
Optionally, users may want to put all code that they need on Github and create a build trigger to the Dockerfile through Quay. When they create a build trigger, Quay will ask for access permissions and once authentication is made inside Github, Quay will have access to user's repository and will be able to build new containers as soon as a push to the repository will be made.
This would fix an error message "Could not clone git repository: Error cloning git repository. Permission denied (publickey).
Please sign in to leave a comment.