Created
April 8, 2015 01:18
-
-
Save pawlik/cdc279c3ef44aad76805 to your computer and use it in GitHub Desktop.
When full clone is too long - make a cache. You can run it with `watch -n 1 ./git-cache.sh git@github.com:Username/RepoName`, it will create cached version on /tmp/git-cache/git@github.com:Username/Reponame so you can clone new repos from there. Good when you make many clones and it's slow. Add apriopriate remotes when needed.
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
cache_dir="/tmp/git-cache/" | |
if [ ! -d "$cache_dir" ] | |
then | |
mkdir -p $cache_dir | |
fi | |
cache_path=$cache_dir$1 | |
if [ ! -d "$cache_path" ] | |
then | |
git clone --mirror $1 $cache_path | |
else | |
echo "cache seems to exist already, go with the update\n" | |
cd $cache_path | |
git remote update | |
fi | |
echo "your cache is available and updated at $cache_path" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment