{"id":46140369,"url":"https://github.com/afeiship/go-gitinfo","last_synced_at":"2026-03-02T06:02:01.571Z","repository":{"id":270473479,"uuid":"146962804","full_name":"afeiship/go-gitinfo","owner":"afeiship","description":"Gitinfo for golang.","archived":false,"fork":false,"pushed_at":"2026-02-08T07:55:24.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-08T14:47:59.703Z","etag":null,"topics":["email","git","go","golang","info","library","ssh","url","username"],"latest_commit_sha":null,"homepage":"","language":"Go","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/afeiship.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-09-01T03:08:02.000Z","updated_at":"2026-02-08T07:55:27.000Z","dependencies_parsed_at":"2024-12-31T13:20:50.928Z","dependency_job_id":"33f35650-4590-4044-8c19-540c79027ea0","html_url":"https://github.com/afeiship/go-gitinfo","commit_stats":null,"previous_names":["afeiship/go-gitinfo","afeiship/sso-weibo-node"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/afeiship/go-gitinfo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fgo-gitinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fgo-gitinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fgo-gitinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fgo-gitinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/go-gitinfo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fgo-gitinfo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29993540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["email","git","go","golang","info","library","ssh","url","username"],"created_at":"2026-03-02T06:02:00.263Z","updated_at":"2026-03-02T06:02:01.562Z","avatar_url":"https://github.com/afeiship.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-gitinfo\n\u003e Gitinfo for golang - Extract git repository information and parse git URLs for GitHub and GitLab.\n\n## Installation\n```sh\ngo get -u github.com/afeiship/go-gitinfo\n```\n\n## Usage\n\n### Get Current Repository Info\n```go\npackage main\nimport (\n\t\"fmt\"\n\t\"github.com/afeiship/go-gitinfo\"\n)\n\nfunc main() {\n\thasGit, info := gitinfo.GetGitInfo()\n\tif !hasGit {\n\t\tfmt.Println(\"Not a git repository\")\n\t\treturn\n\t}\n\tfmt.Println(info)\n}\n```\n\n**Output:**\n```json\n{\n  \"name\": \"afeiship\",\n  \"email\": \"1290657123@qq.com\",\n  \"current_branch\": \"main\",\n  \"hash\": \"bd457285054d8f95f9d4b4840c76873b5d549569\",\n  \"short_hash\": \"bd45728\",\n  \"is_github\": true,\n  \"meta\": {\n    \"original_url\": \"git@github.com:afeiship/go-gitinfo.git\",\n    \"protocol\": \"https\",\n    \"hostname\": \"github\",\n    \"owner\": \"afeiship\",\n    \"repo\": \"go-gitinfo\",\n    \"repo_name\": \"afeiship/go-gitinfo\",\n    \"ssh_url\": \"git@github.com:afeiship/go-gitinfo.git\",\n    \"https_url\": \"https://github.com/afeiship/go-gitinfo.git\",\n    \"url\": \"https://github.com/afeiship/go-gitinfo\",\n    \"base_url\": \"https://github.com\",\n    \"actions_url\": \"https://github.com/afeiship/go-gitinfo/actions\",\n    \"commits_url\": \"https://github.com/afeiship/go-gitinfo/commits\",\n    \"tags_url\": \"https://github.com/afeiship/go-gitinfo/tags\",\n    \"pages_url\": \"https://afeiship.github.io/go-gitinfo/\",\n    \"issues_url\": \"https://github.com/afeiship/go-gitinfo/issues\",\n    \"pull_requests_url\": \"https://github.com/afeiship/go-gitinfo/pulls\"\n  }\n}\n```\n\n### Parse Git URLs\n```go\npackage main\nimport (\n\t\"fmt\"\n\t\"github.com/afeiship/go-gitinfo\"\n)\n\nfunc main() {\n\t// Parse GitHub URL\n\tinfo, err := gitinfo.ParseGitUrl(\"git@github.com:afeiship/go-gitinfo.git\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Repository:\", info.RepoName)\n\tfmt.Println(\"Actions:\", info.ActionsUrl)\n\tfmt.Println(\"Pull Requests:\", info.PullRequestsUrl)\n}\n```\n\n## Supported URLs\n\n### GitHub\n- SSH: `git@github.com:owner/repo.git`\n- HTTPS: `https://github.com/owner/repo.git`\n- Enterprise: `git@github.company.com:owner/repo.git`\n\n### GitLab\n- SSH: `git@gitlab.com:owner/repo.git`\n- HTTPS: `https://gitlab.com/owner/repo.git`\n- Self-hosted: `git@git.example.com:owner/repo.git`\n\n## Generated URLs\n\n| Field | GitHub | GitLab |\n|-------|--------|--------|\n| `actions_url` | `/actions` | `/-/pipelines` |\n| `commits_url` | `/commits` | `/-/commits` |\n| `tags_url` | `/tags` | `/-/tags` |\n| `issues_url` | `/issues` | `/-/issues` |\n| `pull_requests_url` | `/pulls` | `/-/merge_requests` |\n| `pages_url` | `{owner}.github.io/{repo}/` | `{owner}.pages.{hostname}/{repo}/` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fgo-gitinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Fgo-gitinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fgo-gitinfo/lists"}