Last active
August 29, 2015 14:21
-
-
Save koenmetsu/c2c4f92c514b9bbcd84c to your computer and use it in GitHub Desktop.
Bash function: Gitlab replace https with ssh protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# fetch git fetch https://git/someuser/somerepo.git somebranch | |
# will execute instead: | |
# git fetch git@git:someuser/somerepo.git somebranch | |
function fetch() { | |
local old_url="$*" | |
new_url=$(sed 's#https://git/#git@git:#g' <<< $old_url) | |
$new_url | sh | |
} | |
export -f fetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment