Skip to content
Snippets Groups Projects
Commit 588b7566 authored by Louis Moureaux's avatar Louis Moureaux
Browse files

Support users redirecting git https to ssh

Multiple users complained that the installation wasn't working for them. They
were stuck with git asking for their SSH password and no way of providing it
since git is run through CMake.

Detect the configuration that leads to this issue and start the SSH agent if
needed, then register the user's main key with it. Try educating the user about
what is happening and that it's ultimately their fault if something breaks.
parent fc55f30c
No related branches found
No related tags found
1 merge request!27Support users redirecting git https to ssh
...@@ -4,6 +4,30 @@ set -e ...@@ -4,6 +4,30 @@ set -e
BASE_DIR=$PWD BASE_DIR=$PWD
# If the user insists on using SSH for everything, make sure their key is
# unlocked before doing anything else. Otherwise they won't be able to clone.
if [ ! -z "$(git config url.ssh://git@gitlab.cern.ch:7999/.insteadOf)" ]; then
echo "+----------------------------------------------------------------------------------+"
echo "| NOTE ABOUT SSH KEYS |"
echo "| |"
echo "| Your git configuration redirects all clones to SSH. We will try to make it work, |"
echo "| but it may fail if you do not use the default SSH key. In any case running cmake |"
echo "| commands directly will require you ensure an SSH agent is running and your SSH |"
echo "| key is unlocked. |"
echo "+----------------------------------------------------------------------------------+"
echo
echo "===> Unlocking your SSH key..."
# Start an ssh agent if needed
if [ -z "$SSH_AUTH_SOCK" ] || [ -z "$SSH_AGENT_PID" ]; then
eval $(ssh-agent)
fi
# Unlock the key. This will only work if the default key is used for GitLab,
# but we have no easy way of getting this information.
ssh-add
fi
# Get a CMSSW if we don't have one # Get a CMSSW if we don't have one
if [ -z $CMSSW_BASE ]; then if [ -z $CMSSW_BASE ]; then
version=CMSSW_12_4_0 version=CMSSW_12_4_0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment