Reputation: 14869
I would like to let 'cmake' exporting some files from a git repository with a 'git export' command. Everytime I do that I received an error
Permission denied, please try again.
git@xxxx: Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly
If I do it myself from a DOS command line I am asked a password in a prompt. As far as I know my ssh keys have been already provided to the network administrator watching for the git repositories.
Do you know why 'cmake' is not able to pick up my ssh keys? How to prevent asking the password for it?
Below the command I am using
execute_process(
COMMAND git --remote=git+ssh://git@xx/proj.git master source/folder --format=tar.gz > package.tar.gz
RESULT_VARIABLE rv
ERROR_VARIABLE ev
OUTPUT_VARIABLE ov
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Upvotes: 1
Views: 2253
Reputation: 5346
I think CMake cannot ask for user input, so when invoking the Git command and it asks for a password then the input is empty, which causes your command to fail.
You should use a SSH agent so that SSH is already "aware" of your SSH keys so your Git command does not ask for a password; for example this answer indicates how to use it. Another solution would be to pass your password through an environment variable, but the first solution is more appropriate in my opinion.
Upvotes: 2