{"id":18624526,"url":"https://github.com/alex-shpak/gitname","last_synced_at":"2025-06-26T08:33:55.370Z","repository":{"id":86296223,"uuid":"99477194","full_name":"alex-shpak/gitname","owner":"alex-shpak","description":"Automatically set git config properties in local repository based on remote URL","archived":false,"fork":false,"pushed_at":"2021-10-25T08:56:51.000Z","size":25,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T13:12:47.725Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":"","language":"Go","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/alex-shpak.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-08-06T09:41:11.000Z","updated_at":"2024-07-10T10:01:13.000Z","dependencies_parsed_at":"2023-03-12T10:18:46.124Z","dependency_job_id":null,"html_url":"https://github.com/alex-shpak/gitname","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/alex-shpak/gitname","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-shpak%2Fgitname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-shpak%2Fgitname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-shpak%2Fgitname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-shpak%2Fgitname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex-shpak","download_url":"https://codeload.github.com/alex-shpak/gitname/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex-shpak%2Fgitname/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262030477,"owners_count":23247665,"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"],"created_at":"2024-11-07T04:29:24.314Z","updated_at":"2025-06-26T08:33:55.354Z","avatar_url":"https://github.com/alex-shpak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gitname\nSimple tool to set `user.name` and `user.email` or other properties in local git repository based on remote URL.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/alex-shpak/gitname)](https://goreportcard.com/report/github.com/alex-shpak/gitname)\n\n## Use case\nIt is common to have multiple git repositories and platforms to work with. For example you might contribute OSS at `github.com` and have private organisation `github.com/private-organization` at your work, also some repositories at `gitlab.com`. So then you might want to use different email and/or config for these repositories.\n\nHere is where this tool useful. When you run `gitname`, it will set local config in repository according to git remote.  More specific URL has higher priority. See [configuration](#configure) for example.\n\n## Install\n### Homebrew\n```sh\n$ brew tap alex-shpak/gitname http://github.com/alex-shpak/gitname\n$ brew install gitname\n```\n\n### Pre-compiled Binaries\nYou can download binary for your platform directly from [releases](https://github.com/alex-shpak/gitname/releases) page.\n\n### Install from sources\n```\n$ go get -u github.com/alex-shpak/gitname\n$ go install github.com/alex-shpak/gitname\n```\n\n## Configure\nAdd these lines to `.gitconfig` file into your home directory, modify where needed. You can use other global [git config files](https://git-scm.com/docs/git-config#FILES) as well.\n\n```ini\n[user \"github.com\"]\n\tname = Alex Shpak\n\temail = alex-shpak@users.noreply.github.com\n\n[user \"github.com/private-organization\"]\n\tname = Alexander Shpak\n\temail = organization-email@example.com\n\tsigningKey = xxx\n\n[user \"gitlab.com\"]\n\tname = Alex Shpak\n\temail = gitlab-email@example.com\n```\n\n## Run\nNavigate to target git repository and run `gitname`:\n```\n~/Projects/gitname » gitname\n2019/10/11 21:14:54 Committing as Alex Shpak \u003calex-shpak@users.noreply.github.com\u003e\n```\n\nYou can set specific section by passing name of section as argument: `gitname github.com`, this comes useful when there is no remote yet.\n\nYou can also create handy alias.\n\n```sh\n$ git config --global alias.name '!gitname'\n$ git name\n```\n\n## Unset globally configured name\nOptionally run below commands to unset globally configured name and email and [prevent Git](https://git-scm.com/docs/git-config#git-config-useruseConfigOnly) from guessing them in newly cloned repositories.\n\n```sh\n$ git config --global user.name \"\"\n$ git config --global user.email \"\"\n$ git config --global user.useConfigOnly true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-shpak%2Fgitname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-shpak%2Fgitname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-shpak%2Fgitname/lists"}