Rust cargo get private github repository in docker

Viewed 474

I try to use a private GitHub repository in a Dockerfile when I'm building.

I use these commands in the Dockerfile to add the credentials:

RUN git config --global credential.helper 'store --file ~/.git-credentials'

RUN git config --global credential.helper store

RUN echo "$DOCKER_GIT_CREDENTIALS" > ~/.git-credentials

RUN chmod 600 ~/.git-credentials

When I run cargo build --release I get this output:


06:24:01.184422 run-command.c:646       trace: run_command: 'git credential-ghtoken get'                                                    
06:24:01.191216 git.c:576               trace: exec: git-credential-ghtoken get                                                             
06:24:01.191271 run-command.c:646       trace: run_command: git-credential-ghtoken get                                                      
git: 'credential-ghtoken' is not a git command. See 'git --help'.                                                                           
06:24:01.197609 run-command.c:646       trace: run_command: 'git credential-store get'                                                      
06:24:01.203843 git.c:576               trace: exec: git-credential-store get                                                               
06:24:01.203896 run-command.c:646       trace: run_command: git-credential-store get                                                        
warning: url has no scheme:                                                                                                                 
fatal: credential url cannot be parsed:                                                                                                     
fatal: could not read Username for 'https://github.com': No such device or address    

I use ekidd/rust-musl-builder:latest as the base image.

0 Answers
Related