{"id":20916203,"url":"https://github.com/yannoff/su-git","last_synced_at":"2026-04-12T14:41:37.244Z","repository":{"id":26991044,"uuid":"112097114","full_name":"yannoff/su-git","owner":"yannoff","description":"A simple tool to handle multiple git accounts on the same system","archived":false,"fork":false,"pushed_at":"2023-10-26T10:59:52.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T16:27:13.520Z","etag":null,"topics":["git","github","gitlab","ssh-key","sudo"],"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/yannoff.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":"2017-11-26T16:12:02.000Z","updated_at":"2021-12-22T10:12:37.000Z","dependencies_parsed_at":"2022-08-07T12:01:24.120Z","dependency_job_id":"87a6b8e0-eac2-4617-b30f-2b2dbd9beb56","html_url":"https://github.com/yannoff/su-git","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fsu-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fsu-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fsu-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fsu-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yannoff","download_url":"https://codeload.github.com/yannoff/su-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243308597,"owners_count":20270447,"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","github","gitlab","ssh-key","sudo"],"created_at":"2024-11-18T16:20:31.131Z","updated_at":"2025-12-26T15:23:50.549Z","avatar_url":"https://github.com/yannoff.png","language":"Shell","readme":"# su-git\n\nA simple tool to handle multiple git accounts, using multiple SSH keys.\n\n## The reason\n\nI ran into the problem when having to collaborate on 2 distincts `github` accounts simultaneously: my own account and the one I was running for my organization.\n\nHere is the pitfall: each SSH key can be associated with one and **only** one account. \n\nUnfortunately, `git` automatically takes the default key (typically `$HOME/.ssh/id_rsa`) for granted.\n\nSo creating a fresh new SSH key (let's say `$HOME/.ssh/id_rsa2`) and adding the corresponding public key to the repository was not enough to solve the problem. \n\nIndeed, what `git` lacks is an option (like `--identity` on `ssh` command) to specify which private key should be used.\n\n_And here comes **su-git**!_\n\n## Installation\n\nFirst, clone the project into a temporary directory:\n\n```bash\n$ cd /tmp\n$ git clone https://github.com/yannoff/su-git.git\n```\nThen, go inside `su-git` directory, \n\n```bash\n$ cd su-git\n```\n\nthen run:\n\n```bash\n$ make\n$ sudo make install\n```\n\nNow `su-git` can be called from anywhere on your system.\n\n## Usage\n\nPrior to the first run of `su-git`, you need to configure which identity file will be used for the current dir:\n\n\n```bash\n$ git config ssh.identity /path/to/your/private_key\n```\n\n\u003e **NOTE:** `su-git` leverages the powerful `git-config` engine to store its `ssh.identity` option. \n_This means you can configure a global setting for your private key, and override it on a per-project level, as you would do for any other regular git configuration value._\n\nNow you can use `su-git` for `push`/`pull` operations, exactly the same way as `git`, having your identity handled automatically.\n\n**Example:**\n\n1. Use `su-git` for cloning\n\n```bash\n$ su-git clone --identity ~/.ssh/your_rsa git@github.com:dummy/my-project.git\n```\n\n\u003e **NOTE:** When cloning, there is no `.git` folder in the current directory, so `git config` cannot be used here, even if a global setting exists for `ssh.identity`.\n\n2. Configure your identity file from inside the working dir\n\n```bash\n$ cd my-project\n$ git config ssh.identity ~/.ssh/your_rsa\n```\n\n3. Work locally using `git`\n\n```bash\n$ git checkout -b feature/my-awesome-feature\n...\n$ git add .\n$ git commit -m \"My commit\"\n...\n```\n\n4. Use `su-git` when pushing your local branch\n\n```bash\n$ su-git push -u origin feature/my-awesome-feature\n```\n\n\n## Note\n\nThis project was proudly pushed using [su-git](https://github.com/yannoff/su-git \"su-git project\").\n\n## License\n\nLicensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannoff%2Fsu-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyannoff%2Fsu-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannoff%2Fsu-git/lists"}