Skip to content
Snippets Groups Projects
Commit 1f555b1d authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

Automatically detect ssh vs https when setting up remotes.

parent 8554fdd2
No related branches found
No related tags found
1 merge request!47Automatically detect ssh vs https when setting up remotes.
...@@ -17,20 +17,16 @@ then ...@@ -17,20 +17,16 @@ then
exit 1 exit 1
fi fi
git remote set-url origin https://github.com/${GH_USERNAME}/adios2.git git remote set-url origin https://github.com/${GH_USERNAME}/adios2.git
read -p "Setup SSH push access? [(y)/n] " GH_USE_SSH
GH_USE_SSH="${GH_USE_SSH,,}" echo "Testing SSH access to GitHub..."
if [ -z "${GH_USE_SSH}" ] ssh -T git@github.com 2>/dev/null
then if [ $? -eq 1 ]
echo " Empty entry. Using 'y' as default"
GH_USE_SSH="y"
elif [ "${GH_USE_SSH}" != "y" ] && [ "${GH_USE_SSH}" != "n" ]
then
echo " Invalid entry. Using 'y' by default"
GH_USE_SSH="y"
fi
if [ "${GH_USE_SSH}" == "y" ]
then then
echo "Success! Setting up SSH push access to your fork."
git config remote.origin.pushurl "git@github.com:${GH_USERNAME}/adios2.git" git config remote.origin.pushurl "git@github.com:${GH_USERNAME}/adios2.git"
else
echo "SSH access failed. Setting up HTTPS push access instead"
git config remote.origin.pushurl https://${GH_USERNAME}@github.com/${GH_USERNAME}/adios2.git
fi fi
......
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