PositiveGuy
PositiveGuy

Reputation: 20252

Possible to http clone repo to Docker Container?

I see a lot about ssh'ing down a git repo to a container but what about through https?

I exec to my container as a non-root user.
Then I tried to run git clone <my proviate git repo url>

It asked me to auth in, so I typed in my usual username and password for git.

I know it works because I tried it locally in OS X, but when I try through my container, it's giving me remote: Invalid username or password for some reason.

Upvotes: 2

Views: 781

Answers (2)

PositiveGuy
PositiveGuy

Reputation: 20252

forgot I was using two factor auth, needed to use a personal token not my github password.

Upvotes: 1

CodeWizard
CodeWizard

Reputation: 142482

Pulling git into a docker image without leaving ssh keys behind is a similar article about this issue.


According to your comments:

In order to clone the code into your docker using https.
Follow those steps and set this content in your docker file:

  • tun off sslVerify for your domain
  • use http which is a read-only protocol if you can

When using https you will need to supply password or using a certificate. In your case you use docker so you have to set it in your docker file

// or switch off SSL checks completely by executing:
git config --system http.sslverify false

The line will turn off the SSL check

set this in your config to disable it only for the given url and not for all requests

[http "https://weak.example.com"]
    sslVerify = false

http.sslVerify

Whether to verify the SSL certificate when fetching or pushing over HTTPS.


http.sslCAInfo

File containing the certificates to verify the peer with when fetching or pushing over HTTPS

Upvotes: 0

Related Questions