Skip to content

Instantly share code, notes, and snippets.

@damokuro
damokuro / fix_github_https_repo.sh
Created March 21, 2018 11:45 — forked from m14t/fix_github_https_repo.sh
Convert HTTPS github clones to use SSH
#!/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi