Created
January 8, 2025 05:26
-
-
Save slurpyb/564654c1c0e88e05c25b53cda5417c8c to your computer and use it in GitHub Desktop.
gh-clone
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/zsh | |
# CREDIT: https://www.reddit.com/r/git/comments/wgyn0j/comment/ij31p2c/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button | |
# Given a github repo URL, clones the repo in ~/src/<year>/<user>/<repo> | |
set -eu | |
repo="$(echo "$1" | sed -r -e 's|https?://github.com/([^/]+)/([^/]+).*|\1/\2|')" | |
year="$(date +%Y)" | |
cd ~/src/$year/ | |
mkdir -p "$repo" | |
cd "$repo" | |
pwd | |
cd .. | |
git clone "ssh://[email protected]/$repo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment