{"id":19967264,"url":"https://github.com/thebengeu/auto-git-remote-add-upstream","last_synced_at":"2026-04-15T14:39:19.533Z","repository":{"id":193799482,"uuid":"689250428","full_name":"thebengeu/auto-git-remote-add-upstream","owner":"thebengeu","description":"Git alias and hook to automatically add `upstream` remote using auto-detected URL when cloning your public or private forks","archived":false,"fork":false,"pushed_at":"2024-06-25T00:39:06.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T08:42:57.101Z","etag":null,"topics":["clone","fork","git","git-clone","git-hook","git-hooks","github","github-api","upstream"],"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/thebengeu.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":"2023-09-09T08:14:15.000Z","updated_at":"2024-06-25T00:39:09.000Z","dependencies_parsed_at":"2024-11-13T06:01:36.760Z","dependency_job_id":null,"html_url":"https://github.com/thebengeu/auto-git-remote-add-upstream","commit_stats":null,"previous_names":["thebengeu/auto-git-remote-add-upstream"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebengeu%2Fauto-git-remote-add-upstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebengeu%2Fauto-git-remote-add-upstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebengeu%2Fauto-git-remote-add-upstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebengeu%2Fauto-git-remote-add-upstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thebengeu","download_url":"https://codeload.github.com/thebengeu/auto-git-remote-add-upstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241399464,"owners_count":19956911,"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":["clone","fork","git","git-clone","git-hook","git-hooks","github","github-api","upstream"],"created_at":"2024-11-13T02:40:42.866Z","updated_at":"2026-04-15T14:39:14.507Z","avatar_url":"https://github.com/thebengeu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automatic `git remote add upstream`\n\nGit alias and hook to automatically add `upstream` remote using auto-detected URL when cloning your public or private forks.\n\n## Requirements\n\n- [jq](https://jqlang.github.io/jq/download/)\n\n## Setup `rau` Git Alias and Hook\n\n```console\ngit clone https://github.com/thebengeu/auto-git-remote-add-upstream.git\nsh auto-git-remote-add-upstream/setup-git-alias-and-hook.sh\n```\n\n## `rau` Git Alias\n\nIf the `upstream` remote is not set and there are commits where you aren't the author and the `origin` remote URL seems to be a GitHub repo under your username, `git rau` will attempt to add the `upstream` remote using the auto-detected URL of:\n\n1. The upstream repo that `origin` was forked from, if explicitly set on GitHub.\n2. The earliest-created repo on GitHub that contains the latest local commit not authored by you.\n   - This heuristic should be good enough for most cases, whether your fork is public or private.\n   - If that latest local commit isn't recent, in rare cases another fork containing that commit, that isn't explicitly set as a fork on GitHub, may have overtaken the earliest-created repo in some measures. Any such repos created later but with more stars, forks, open issues or watchers will be listed for your consideration.\n\n## `post-checkout` Git Hook\n\nThe setup script adds `git rau` to the `post-checkout` Git hook within the [template directory](https://git-scm.com/docs/git-init#_template_directory) set in the `init.templateDir` Git configuration variable, which will be set to `$XDG_CONFIG_HOME/git/template` if not already set.\n\n## Options\n\n- Run `setup-git-alias-and-hook.sh \u003calias-name\u003e` to use an alias name other than `rau`.\n- Set the `GH_TOKEN` or `GITHUB_TOKEN` environment variables to a GitHub personal access token to:\n  - Increase the GitHub API rate limit from 60 to 5000 requests per hour.\n  - Handle cases where the upstream repo is private.\n- Set the `GH_USERNAME` environment variable to your GitHub username if your GitHub username can't be auto-detected from the `user.email` Git configuration variable.\n\n## Troubleshooting\n\nCurrently, most cases should be covered. There may be some edge cases that haven't been addressed to avoid over-complicating the initial versions. Please [create an issue](https://github.com/thebengeu/auto-git-remote-add-upstream/issues/new/choose) for any real-world unhandled cases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebengeu%2Fauto-git-remote-add-upstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebengeu%2Fauto-git-remote-add-upstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebengeu%2Fauto-git-remote-add-upstream/lists"}