Skip to content

Instantly share code, notes, and snippets.

@michaelsilver
michaelsilver / fix_github_https_repo.sh
Last active February 12, 2022 16:09 — 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
http_to_ssh(){
echo ""
echo "Checking for $1..."
REPO_URL=`git remote -v | grep -m1 "^$1" | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
if [ "$1" == "upstream" ]; then