Crascit/DownloadProject

Not working for git repositories with ssh authentication

Closed this issue · 4 comments

When I try to use it with a project that requires SSH autentication it is not working.
I use the url in the form git@github.com:Crascit/DownloadProject.git but it seems not able to grab the private key.
Is it supported?

Without seeing your CMakeLists.txt file, I can only guess what you're trying to do. It sounds like you are trying to use download_project() to download the DownloadProject files from GitHub, but that's a chicken-and-egg problem. You need to manually download the DownloadProject.cmake and DownloadProject.CMakeLists.cmake.in files and add them to your own project. Then you can include(DownloadProject) and use the download_project() function.

As far as SSH support goes, it should work fine (I have lots of projects doing exactly that). Also make sure your cmake executable was built with SSL support enabled. If you've obtained it from a package manager, it probably has it, but if you've built it yourself from source, you may need to explicitly enable OpenSSL in your bootstrap/configure step.

Sorry, puting the DownloadProject url as example was bad becaue it produce misunderstanding. Let me show you what I have:

include(DownloadProject)
download_project(PROJ                myProtectedGithubProject
                 GIT_REPOSITORY      git@github.com:me/myprotectedproject.git
                 GIT_TAG             master
                 UPDATE_DISCONNECTED 1
)

The singularity here is that this project is not public. It is protected and git needs to authenticate using the private key. The private key is in the standard location ~/.ssh/ida_rsa.
It could be that this is a problem just from the ExternalProject_Add.
Everything is done in Windows and the cmake is the standard one got from the x64 Windows installer, version 3.8.2.

Okay then, your situation should work fine (I have projects of my own which follow a similar path). It's likely that your SSH key handling isn't working properly. It sounds like you're using a MinGW shell. If so, then please confirm you can clone the repo directly from the MinGW shell command line. If you're not building from within such a shell, then it would be unsurprising if it wasn't then finding your ssh details if they are only available from within such a shell.

Interesting, if I configure from the Windows command prompt then it just fail without asking any passphrase for the private key. If I run it from a git bash command then it pop up in between a window asking for the passphrase where I can enter and it works.
Definitely is not a problem of DownloadProject, it has to be from CMake or how the command prompt interacts with SSH.
Thanks, your information helped alot.