Skip to content

Instantly share code, notes, and snippets.

@thinkycx
Last active April 24, 2018 13:20
Show Gist options
  • Save thinkycx/19cdd2f44cf8a74889fcd6809801652f to your computer and use it in GitHub Desktop.
Save thinkycx/19cdd2f44cf8a74889fcd6809801652f to your computer and use it in GitHub Desktop.
a wrapper of git clone used in vmware shared folders
#!/bin/bash
# author: thinkycx
# date: 2018-04-24
:<<EOF
usage:
alias git2 ~/scripts/git2.sh
git2 clone git://github.com/author/project_name.git [author@project_name]
use it in vmware shared folders which is actually stored on windows
as to fix problems like this:
➜ d git clone git://github.com/mzet-/linux-exploit-suggester.git
Cloning into 'linux-exploit-suggester'...
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[TODO]
- use regex & change DEFAULT FILE_NAME to author@project_name
EOF
URL=$2
# default PROJECT_NAME project_name.git
FILE_NAME=${URL##git*/}
FILE_NAME=${FILE_NAME##https*/}
if [ $3 ];then
PROJECT_NAME=$3
else
PROJECT_NAME=$FILE_NAME
fi
TARGET_PATH="/tmp/"$PROJECT_NAME
echo "URL #" $URL
echo "PROJECT_NAME #" $PROJECT_NAME
if [ "$1" = "clone" ];then
echo "[*] git2 is clone..."
git clone $URL $TARGET_PATH && mv $TARGET_PATH ./
echo "[*]" $PROJECT_NAME "is cloned !"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment