Skip to content

Instantly share code, notes, and snippets.

@turtlemonvh
Last active January 22, 2016 17:54
Show Gist options
  • Save turtlemonvh/798a24c4e2a30a5aa2a4 to your computer and use it in GitHub Desktop.
Save turtlemonvh/798a24c4e2a30a5aa2a4 to your computer and use it in GitHub Desktop.
Go Get from Stash

Go Get from Stash

Add this function to your ~/.bashrc.

Use like

# Just use the url that stash recommends for cloning over ssh
go-get-stash ssh://[email protected]:7999/il/common.git

You can use this package in your go files like

import "stash.in.ionicsecurity.com/scm/il/common.git/common"
# Fetch repo from stash over ssh
# Clone it into a place where Go expects to find it
go-get-stash() {
repo=$1;
# Create the path by string substitution
path=${repo/\.com:7999/.com\/scm};
path=$GOPATH/src/${path/ssh:\/\/git\@stash/stash};
echo "Cloning '$repo' into '$path'";
git clone $repo $path
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment