Created
January 14, 2016 00:28
-
-
Save mingchen/992442e928952da59dbd to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# | |
# Author: Ming Chen | |
# | |
# Replace git protocol git:// with https:// in .git/config | |
# This solve this issue when you behind a firewall like a company and your firewall ban git protocol. | |
# | |
# Example error form git: | |
# | |
# fatal: unable to connect to github.com: | |
# github.com[0: 192.30.252.130]: errno=Connection refused | |
# | |
# | |
# Usage example: find . -type d -name .git -print -exec git_replace_git_with_https.sh {} \; | |
# | |
TMPFILE=/tmp/config.tmp.$$ | |
GITCONFIG=config | |
if [ -d .git ]; then | |
GITCONFIG=.git/config | |
fi | |
if [ -f $GITCONFIG ]; then | |
sed 's/url = git:/url = https:/' $GITCONFIG > $TMPFILE | |
mv $TMPFILE $GITCONFIG | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment