Skip to content

Instantly share code, notes, and snippets.

@antoni
Last active December 9, 2018 17:19
Show Gist options
  • Save antoni/0baa816895d7155c7f41e155e2ee7f70 to your computer and use it in GitHub Desktop.
Save antoni/0baa816895d7155c7f41e155e2ee7f70 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
: ' Usage:
bash <(wget --quiet --output-document=- https://gist.githubusercontent.com/antoni/0baa816895d7155c7f41e155e2ee7f70/raw)
'
# Replaces $1 with $2 in the origin named 'origin' of Git repo
# Should be executed from inside of the repository folder
function replace_in_origin() {
REMOTE_URL=$(git ls-remote --get-url)
REMOTE_URL=${REMOTE_URL/$1/$2}
git remote set-url origin $REMOTE_URL
echo "Remote URL changed to "$(git ls-remote --get-url)
}
replace_in_origin "KreditechSSL" "kreditech"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment