Skip to content

Instantly share code, notes, and snippets.

@liaoyw
Created December 30, 2018 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liaoyw/c0bb22a49db9a9bce2b1a55276452700 to your computer and use it in GitHub Desktop.
Save liaoyw/c0bb22a49db9a9bce2b1a55276452700 to your computer and use it in GitHub Desktop.
#!/bin/bash
function gitclone() {
cd ~/workspace
path=$1
# remove http:// or https:// at the begining
path=${path#http://}
path=${path#https://}
# replace xx.com:/path/dir to xx.com/path/dir
path=${path//://}
path=${path#git@}
path=${path%.git}
https_proxy=http://localhost:60797 git clone $1 $path
}
gitclone $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment