dev-environments icon indicating copy to clipboard operation
dev-environments copied to clipboard

Can't create dev environment with private GitHub repository

Open martialanouman opened this issue 3 years ago • 24 comments

Describe the bug I can't create dev env with private GitHub repo

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Dev Environnements'
  2. Fill create field with private GitHub repo
  3. Click on 'Create button'
  4. See error

Expected behavior Successful creation of dev env

Desktop (please complete the following information):

  • OS: OS X
  • Version 12.0 Beta (21A5248p)

martialanouman avatar Jun 27 '21 00:06 martialanouman

Hi @DewZ89

In step 4, what is the error you see?

Can you also please follow the instructions here to upload a diagnostics report: https://docs.docker.com/docker-for-windows/troubleshoot/#diagnose-and-feedback ?

rumpl avatar Jun 28 '21 07:06 rumpl

Hello @rumpl,

~~As I'm also seeing this issue on the latest version of macOS Big Sur + latest version of Docker for Mac, I noticed that the diagnostics are only possible for Docker for Windows, not for the macOS version, so those steps won't work here.~~ EDIT: The link was for Windows and I somehow missed the Get Support button, my bad!

I can clone my private repositories locally just fine, but Docker doesn't seem to have access to ~/.ssh, as the authentication is failing.

  1. Entered [email protected]:<user>/<repo>.git into the input field and hit the Create button.
  2. Clicked the created Dev Environment and saw the following in the logs:
Preparing to clone inside a volume
Installing credential helpers... done
Cloning into '/code'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Dids avatar Jun 28 '21 10:06 Dids

@rumpl Sorry about that, edited the previous message to correct myself.

Here's my diagnostics ID in case it helps: 6D252ED7-F5C4-4642-8C2B-189FB7322DBC/20210628103808

Dids avatar Jun 28 '21 10:06 Dids

Figured it out!

Apparently I just needed to add the SSH key to the SSH agent, which I've actually never had to do before, but it makes sense in hindsight:

ssh-add $HOME/.ssh/id_rsa

Dids avatar Jun 28 '21 10:06 Dids

Glad you made it work! We'll update the docs, add a paragraph about cloning over SSH.

@DewZ89 could you try and do the same thing @Dids did and tell us if that worked for you?

rumpl avatar Jun 28 '21 12:06 rumpl

@DewZ89 if you fancy giving us some direct feedback or chatting to the team on a call drop me an email on [email protected] :D

nebuk89 avatar Jul 05 '21 08:07 nebuk89

I have the same problem with private repo but on Self-Hosted Gitlab. I'm using Windows 10.

PS C:\Projekty\TMP> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      19041  0


PS C:\Projekty\TMP>

SSH Agent is running:

PS C:\Users\dawid> Get-Service ssh-agent

Status   Name               DisplayName
------   ----               -----------
Running  ssh-agent          OpenSSH Authentication Agent


PS C:\Users\dawid>

and the key is added:

PS C:\Users\dawid> ssh-add -L
ssh-ed25519 XXXXXXXXXXXXXX gitlab-ssh-key
PS C:\Users\dawid>

and I can clone the repo:

PS C:\Projekty\TMP> git clone git@XXXXXXXXX:dawidp/toshi.git
Cloning into 'toshi'...
remote: Enumerating objects: 18, done.
remote: Total 18 (delta 0), reused 0 (delta 0), pack-reused 18
Receiving objects: 100% (18/18), 17.95 KiB | 1.99 MiB/s, done.
Resolving deltas: 100% (4/4), done.
PS C:\Projekty\TMP>

but when I try to launch Dev Environments in Docker Desktop I get this error:

Preparing to clone inside a volume
Installing credential helpers... done
Cloning into '/code'...
git@XXXXXXXXX: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

dawidp avatar Jul 08 '21 17:07 dawidp

Issue was closed automatically because we merged a PR on this subject. Still a work in progress

glours avatar Jul 09 '21 13:07 glours

I have the same problem. I added ssh key with ssh-add but still does not work with private repo on macOS.

bounlu avatar Jul 15 '21 06:07 bounlu

@DewZ89 if you fancy giving us some direct feedback or chatting to the team on a call drop me an email on [email protected] :D

Hi @nebuk89 Sorry for my late reply. i updated Docker Desktop yesterday, let me try again and I make you a feedback.

martialanouman avatar Jul 15 '21 07:07 martialanouman

I think I have the latest version 6.5.2 (also there is no way to check version) and the problem stil occurs.

dawidp avatar Jul 20 '21 08:07 dawidp

~I'm unable to clone from an internal - what some might call "private" repo (but not private in terms of GH repo permissions) accessible through a corp VPN.~

EDIT: What I'm experiencing must be a separate issue, so let's track it as such: #35.

cbrunnkvist avatar Jul 22 '21 11:07 cbrunnkvist

@DewZ89 @dawidp @bounlu we just released a new version of Docker Desktop 3.6.0, can you install it by clicking on the Check for Updates menu and check if the issue is resolved with this new version? You can also check that your ssh configuration is working well by cloning the repository locally (via ssh of course 😅)

glours avatar Aug 12 '21 08:08 glours

Sure @glours

martialanouman avatar Aug 12 '21 17:08 martialanouman

Image 12-08-2021 at 21 48

@glours I still get the same error message

martialanouman avatar Aug 12 '21 21:08 martialanouman

image

@glours same for me

bounlu avatar Aug 17 '21 03:08 bounlu

I have the same problem. I added ssh key with ssh-add but still does not work with private repo on macOS.

@bounlu you're mentioning ssh but you are using an https git url, can you try with the ssh url of the git repo instead?

glours avatar Aug 17 '21 21:08 glours

I have the same problem. I added ssh key with ssh-add but still does not work with private repo on macOS.

@bounlu you're mentioning ssh but you are using an https git url, can you try with the ssh url of the git repo instead?

@glours ohh right, my bad. It works with ssh. thanks. 👍

bounlu avatar Aug 18 '21 06:08 bounlu

Using https protocol get this error:

Preparing to clone inside a volume Installing credential helpers... done Cloning into '/code'... fatal: unable to access 'https://rhodecode.mycompany.com/myproduct/myservice/': SSL certificate problem: unable to get local issuer certificate exit code 128

I have added the ssh keys and agent running but this problem seems to be related with certificates. I have put ca.crt (but no other) into my $HOME/.docker/certs.d/rhodecode.mycompany.com folder and restarted the docker desktop (v3.5.2) but that didn't help.

mhelin avatar Sep 15 '21 07:09 mhelin

I have a similar issue with https, it does not recognize the string between https:// and @ as a username and tries to resolve that as a dns name.

Edik-Mkoyan-Vineti avatar Jun 14 '22 10:06 Edik-Mkoyan-Vineti

I also cannot connect to an organizational repository using https as the server uses a self-signed organizational root certificate.

Error presented during step 3 - Preparing:

Preparing to clone inside a volume
Installing credential helpers... done
Cloning into '/code'...
fatal: unable to access 'https://myurl.com/myrepo.git/': SSL certificate problem: self signed certificate in certificate chain
exit code 128

ssl cloning is disabled on the server so that is not an option.

thetacom avatar Aug 14 '22 03:08 thetacom

I had a similar problem, where I would get the error "Host key verification failed." with no other information. After trying a large number of things (both in Windows PowerShell and WSL Bash), I finally stumbled upon a solution. I was trying to set up a dev environment for a private BitBucket repository, and although I had set up my SSH key in BitBucket, I had not yet cloned the repository outside of setting up dev environments in Docker. The solution was to either 1) clone the code locally (which will prompt you for accepting the host key), or 2) do ssh-keyscan bitbucket.org and add that to ~\.ssh\known_hosts (in WINDOWS).

But... now it just gets stuck forever on "Cloning into '/com.docker.devenvironments.code'..." :(

joeskeen avatar Feb 16 '23 22:02 joeskeen

But... now it just gets stuck forever on "Cloning into '/com.docker.devenvironments.code'..." :(

Can confirm, also experiencing this issue on Docker Desktop v4.16.3, Windows 10 Pro 22H2.

SSH key and everything working when I try to clone locally manually using the relevant Git commands.

STBoyden avatar Feb 21 '23 23:02 STBoyden

@STBoyden I had the same problem with that exact version of windows. Follow the instructions here to add an ssh key. Start docker Then you can use the https link of the git repo when setting up the dev enviroment. (I got the same error when I tried using ssh details [email protected]... to setup the dev env) That's it. It should work. docker desktop version: 4.22.0

ziwer1 avatar Aug 18 '23 03:08 ziwer1