Last active
April 24, 2018 13:20
-
-
Save thinkycx/19cdd2f44cf8a74889fcd6809801652f to your computer and use it in GitHub Desktop.
a wrapper of git clone used in vmware shared folders
This file contains hidden or 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/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