{"id":15355843,"url":"https://github.com/fibo/gh-clone","last_synced_at":"2026-01-07T13:32:56.692Z","repository":{"id":30509217,"uuid":"34063638","full_name":"fibo/gh-clone","owner":"fibo","description":"GitHub clone repo util","archived":false,"fork":false,"pushed_at":"2024-07-12T09:22:44.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-23T07:06:26.314Z","etag":null,"topics":["git-clone","github","productivity"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fibo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-16T15:21:44.000Z","updated_at":"2025-02-01T18:54:14.000Z","dependencies_parsed_at":"2024-07-12T10:59:08.254Z","dependency_job_id":null,"html_url":"https://github.com/fibo/gh-clone","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fgh-clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fgh-clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fgh-clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibo%2Fgh-clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fibo","download_url":"https://codeload.github.com/fibo/gh-clone/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240966417,"owners_count":19886071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git-clone","github","productivity"],"created_at":"2024-10-01T12:25:59.410Z","updated_at":"2026-01-07T13:32:56.673Z","avatar_url":"https://github.com/fibo.png","language":"Shell","readme":"# gh-clone\n\n\u003e GitHub clone repo util\n\n[![KLP](https://fibo.github.io/svg/badges/klp.svg)](https://fibo.github.io/kiss-literate-programming)\n\nVery simple shell function that let you quickly clone GitHub repositories.\n\nAh, and it is also my first bash literate programming experiment.\nDo not edit *fun.sh*, run instead `make fun` to generate source from this file.\n\n## Usage\n\n```sh\ngh-clone [user/]repo\n```\n\n## Annotated source\n\n`gh-clone` expects one parameter, otherwise it prints its **usage**\n\n    if [ -z \"$1\" ]\n    then\n    \tcat \u003c\u003c-EOF\n    \t# GitHub clone repo util\n    \t##\n    \t# Installation instructions, source and license available here:\n    \t# https://github.com/fibo/gh-clone\n    \t##\n    \tUSAGE: gh-clone [user/]repo\n    \tEOF\n    \treturn 0\n    fi\n\nRepos will be cloned under folder `$GITHUB_DIR` which defaults to *~/github.com*.\n\n    GITHUB_DIR=${GITHUB_DIR:-$HOME/github.com}\n\n`MY_GITHUB_USER` is prompted once, if not already configured.\n\n    MY_GITHUB_USER=$(git config --global github.user)\n    if [ -z \"$MY_GITHUB_USER\" ]\n    then\n    \tcat \u003c\u003c-EOF\n\tMissing github.user config, run a command like\n\n    \t\tgit config --global github.user \u003cMY_GITHUB_USER\u003e\n    \tEOF\n    \treturn 0\n    fi\n\nParse parameter which can be given in the form `$GITHUB_USER/$REPO_NAME` or just `$REPO_NAME`.\n\n    GITHUB_USER=$(echo \"$1\" | cut -d / -f1)\n    REPO_NAME=$(echo \"$1\" | cut -d / -f2)\n\nIn the latter case `$GITHUB_USER` defaults to `$MY_GITHUB_USER`.\n\n    if [ \"$REPO_NAME\" = \"$GITHUB_USER\" ]\n    then\n    \tGITHUB_USER=$MY_GITHUB_USER\n    fi\n\nCreate parent directory if it does not exist.\n\n    mkdir -p \"$GITHUB_DIR/$GITHUB_USER\"\n    cd \"$GITHUB_DIR/$GITHUB_USER\"\n\nDo nothing if the repo is already cloned.\n\n    if [ -d \"$REPO_NAME\" ]\n    then\n      echo \"Repo directory $GITHUB_USER/$REPO_NAME already exists\"\n    else\n\nClone repo if folder does not exist.\nUse `git clone --recursive` to initialize and update submodules.\n\n      git clone --recursive git@github.com:$GITHUB_USER/$REPO_NAME.git\n    fi\n\nEnter repo folder\n\n      cd $REPO_NAME\n\nClean up\n\n    unset GITHUB_DIR\n    unset GITHUB_USER\n    unset MY_GITHUB_USER\n    unset REPO_NAME\n\n## Installation\n\nTo install, do something like the following.\n\nClone the repo somewhere\n\n```bash\nmkdir -p ~/.shell\ncd ~/.shell\ngit clone git://github.com/fibo/gh-clone.git\n```\n\nEdit your *~/.profile* and add the following\n\n```bash\nsource ~/.shell/gh-clone/fun.sh\n```\n\n## License\n\n[MIT](https://fibo.github.io/mit-license)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibo%2Fgh-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffibo%2Fgh-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibo%2Fgh-clone/lists"}