Created
August 17, 2023 08:29
-
-
Save naranyala/c228478066fc5d841d05c43692e1a758 to your computer and use it in GitHub Desktop.
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 | |
# Check if the script was invoked with at least one argument | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <GitHub Repository URL> [Custom Repository Name]" | |
exit 1 | |
fi | |
# Extract the repository name from the source URL | |
source_url="$1" | |
repo_name=$(basename "$source_url" .git) | |
# Check if a custom repository name is provided as the second argument | |
if [ $# -eq 2 ]; then | |
repo_name="$2" | |
fi | |
# Construct the git clone command | |
clone_command="git clone $source_url" | |
# Clone the repository | |
$clone_command | |
# Remove the .git directory from the cloned repository folder | |
rm -rf "$repo_name/.git" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment