{"id":17765414,"url":"https://github.com/patrickdappollonio/gc-rust","last_synced_at":"2025-05-12T21:49:48.069Z","repository":{"id":254393255,"uuid":"814837308","full_name":"patrickdappollonio/gc-rust","owner":"patrickdappollonio","description":"Clone GitHub repositories like a champ!","archived":false,"fork":false,"pushed_at":"2025-01-25T23:17:58.000Z","size":236,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T03:51:21.319Z","etag":null,"topics":["cloning","github","repository"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickdappollonio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-06-13T20:10:02.000Z","updated_at":"2025-03-22T23:03:05.000Z","dependencies_parsed_at":"2024-08-28T00:38:23.103Z","dependency_job_id":null,"html_url":"https://github.com/patrickdappollonio/gc-rust","commit_stats":null,"previous_names":["patrickdappollonio/gc-rust"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fgc-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fgc-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fgc-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Fgc-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickdappollonio","download_url":"https://codeload.github.com/patrickdappollonio/gc-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830550,"owners_count":21970997,"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":["cloning","github","repository"],"created_at":"2024-10-26T20:12:59.305Z","updated_at":"2025-05-12T21:49:48.060Z","avatar_url":"https://github.com/patrickdappollonio.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `gc-rust` a GitHub clone helper\n\n- [`gc-rust` a GitHub clone helper](#gc-rust-a-github-clone-helper)\n    - [Installation](#installation)\n    - [Usage](#usage)\n    - [Defining a location for the repositories](#defining-a-location-for-the-repositories)\n    - [Specifying a branch](#specifying-a-branch)\n\n`gc-rust` is a tiny Rust application that allows you to clone GitHub repositories with ease to a predetermined location.\n\nAs a Go developer, I liked the idea that my code was organized using a `$GOPATH`, in the form of:\n\n```bash\n$HOME/go/src/github.com/\u003cusername\u003e/\u003crepository\u003e\n```\n\nSo I kept maintaining even non-Go projects in the same way.\n\n![Example of a cloned repository](./carbon.png)\n\nThis is where `gc-rust` comes in handy: Given a GitHub repository URL, it will perform the `git clone` operation by finding the appropriate location for the resulting folder.\n\nFor example, given the repository:\n\n```bash\ngithub.com/example/application\n```\n\nIt will correctly create the folder structure so the repository is cloned to:\n\n```bash\n$HOME/go/src/github.com/example/application\n```\n\nYou can configure the location where the repositories are cloned by setting the `$GC_DOWNLOAD_PATH` environment variable. [Instructions below](#defining-a-location-for-the-repositories).\n\nIf there was a preexistent folder in the location where the clone should happen, it will ask you if you want to overwrite it. **This will destroy any prior content in the destination folder!**\n\n### Installation\n\nDownload a copy of the binary and place it anywhere in your `$PATH`. Downloads are available in the [releases page](https://www.github.com/patrickdappollonio/gc-rust/releases/latest).\n\nIf you have Homebrew installed on macOS or Linux, you can also install it via:\n\n```bash\nbrew install patrickdappollonio/tap/gc-rust\n```\n\n### Usage\n\nTo clone a GitHub repository, you can use any of the following instructions:\n\n```bash\ngc-rust git@github.com:example/application.git\ngc-rust github.com/example/application\ngc-rust example/application\ngc-rust https://github.com/example/application\ngc-rust https://github.com/example/application/issues\ngc-rust https://github.com/example/application/security/dependabot\ngc-rust https://github.com/example/application/this/is/a/made/up/path\n```\n\nAll of them will detect the repository as `github.com/example/application` and clone it to the correct location.\n\nThe output of `gc-rust` will all be printed to `stderr` with one exception: the folder location where it was cloned. This is useful if you want to create a function that both clones a repository and then `cd` into it:\n\n```bash\nfunction gc() {\n  if ! type \"gc-rust\" \u003e /dev/null; then\n    echo -e \"Install gc-rust first from github.com/patrickdappollonio/gc-rust\"\n    exit 1\n  fi\n\n  cd \"$(gc-rust \"$@\")\" || return\n}\n```\n\nWith this in your `.bashrc` or `.bash_profile`, you can now simply run `gc` and it will clone the repository and `cd` into it:\n\n```bash\n$ pwd\n/home/patrick/go/src/github.com/patrickdappollonio/gc-rust\n\n$ gc https://github.com/patrickdappollonio/http-server\n Cloning patrickdappollonio/http-server...\nCloning into '/home/patrick/Golang/src/github.com/patrickdappollonio/http-server'...\nremote: Enumerating objects: 848, done.\nremote: Counting objects: 100% (228/228), done.\nremote: Compressing objects: 100% (156/156), done.\nremote: Total 848 (delta 183), reused 72 (delta 72), pack-reused 620 (from 1)\nReceiving objects: 100% (848/848), 4.11 MiB | 17.99 MiB/s, done.\nResolving deltas: 100% (469/469), done.\n Successfully cloned patrickdappollonio/http-server into /home/patrick/Golang/src/github.com/patrickdappollonio/http-server\n\n$ pwd\n/home/patrick/go/src/github.com/patrickdappollonio/http-server\n```\n\n### Defining a location for the repositories\n\nBy default, **`gc-rust` will clone the repositories to the path defined in the environment variable `$GC_DOWNLOAD_PATH`**. If this variable is not set, it will use the `$GOPATH` environment variable since the original idea came from Go project management. If neither are defined you'll see an error.\n\n### Specifying a branch\n\nContrary to what you might think, **`gc-rust` will not deduce a branch name from the URL**. Instead, it will clone using whatever branch is currently set as the default in the repository. If you want to clone a specific branch, you can do so by specifying the `-b` or `--branch` flag:\n\n```bash\n# this will clone `patrickdappollonio/http-server` into the `feature-branch` branch,\n# and not the branch called `example` (as seen by the URL)\ngc-rust https://github.com/patrickdappollonio/http-server/tree/example -b feature-branch\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Fgc-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickdappollonio%2Fgc-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Fgc-rust/lists"}