{"id":16898691,"url":"https://github.com/alexandear/import-gitlab-commits","last_synced_at":"2025-04-05T06:08:36.316Z","repository":{"id":45738998,"uuid":"335430165","full_name":"alexandear/import-gitlab-commits","owner":"alexandear","description":"Import commits from a private GitLab repository in an anonymized way.","archived":false,"fork":false,"pushed_at":"2024-10-07T11:33:32.000Z","size":5642,"stargazers_count":158,"open_issues_count":11,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-13T17:45:30.528Z","etag":null,"topics":["git","gitlab-api","hacktoberfest"],"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/alexandear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2021-02-02T21:38:16.000Z","updated_at":"2024-10-07T01:14:38.000Z","dependencies_parsed_at":"2023-12-11T14:42:37.133Z","dependency_job_id":"8954026b-ef67-469f-b427-aff20c0a23b8","html_url":"https://github.com/alexandear/import-gitlab-commits","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/alexandear%2Fimport-gitlab-commits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandear%2Fimport-gitlab-commits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandear%2Fimport-gitlab-commits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandear%2Fimport-gitlab-commits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexandear","download_url":"https://codeload.github.com/alexandear/import-gitlab-commits/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294539,"owners_count":20915340,"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","gitlab-api","hacktoberfest"],"created_at":"2024-10-13T17:45:01.278Z","updated_at":"2025-04-05T06:08:36.296Z","avatar_url":"https://github.com/alexandear.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Import GitLab Commits\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/alexandear/import-gitlab-commits)](https://goreportcard.com/report/github.com/alexandear/import-gitlab-commits)\n\nThe tool to import commits from private GitLab to separate repo. Can be used to show your programming activity for another company in GitHub.\n\nCheck out this informative blog post for a practical use case on how to import GitLab commits [here](https://alexandear.github.io/posts/2023-03-08-import-gitlab-commits/).\n\n## Getting Started\n\n1. Download and install [Go](https://go.dev/dl/).\n2. Install the program by running the command in a shell:\n\n    ```shell\n    go install github.com/alexandear/import-gitlab-commits@latest\n    ```\n\n3. Set environment variables and run `import-gitlab-commits`:\n\n    ```shell\n    export GITLAB_BASE_URL=\u003cyour_gitlab_server_url\u003e\n    export GITLAB_TOKEN=\u003cyour_gitlab_token\u003e\n    export COMMITTER_NAME=\"\u003cName Surname\u003e\"\n    export COMMITTER_EMAIL=\u003cmail@example.com\u003e\n\n    $(go env GOPATH)/bin/import-gitlab-commits\n    ```\n\nwhere\n\n- `GITLAB_BASE_URL` is a GitLab [instance URL](https://stackoverflow.com/questions/58236175/what-is-a-gitlab-instance-url-and-how-can-i-get-it), e.g. `https://gitlab.com`, `https://gitlab.gnome.org` or any GitLab server;\n- `GITLAB_TOKEN` is a personal [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token);\n- `COMMITTER_NAME` is your GitHub name with surname, e.g. `John Doe` (can be passed to `git config user.name`);\n- `COMMITTER_EMAIL` is your GitHub email, e.g. `john.doe@example.com` (valid for `git config user.email`);\n- `$(go env GOPATH)/bin/` is the path where `import-gitlab-commits` installed.\n\n## Example\n\nContributions before running `import-gitlab-commits`:\n\n\u003cpicture\u003e\n \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"screenshots/contribs_before_dark.png\"\u003e\n \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"screenshots/contribs_before_light.png\"\u003e\n \u003cimg alt=\"Screenshot of GitHub contributions graph before running import-gitlab-commits\" src=\"screenshots/contribs_before_dark.png\" width=\"1000\"\u003e\n\u003c/picture\u003e\n\nAfter:\n\n\u003cpicture\u003e\n \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"screenshots/contribs_after_dark.png\"\u003e\n \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"screenshots/contribs_after_light.png\"\u003e\n \u003cimg alt=\"Screenshot of GitHub contributions graph after running import-gitlab-commits with a lot of activity\" src=\"screenshots/contribs_after_dark.png\" width=\"1000\"\u003e\n\u003c/picture\u003e\n\n## Internals\n\nWhat work the tool does:\n\n- gets current user info by `GITLAB_TOKEN`;\n- fetches from `GITLAB_BASE_URL` projects that the current user contributed to;\n- for all projects fetches commits where author's email is the current user's email;\n- creates new repo `repo.gitlab.yourcompany.com.currentusername` and commits all fetched commits with message\n`Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH`, commit date `GITLAB_COMMIT_DATE`, and commit author `COMMITTER_NAME \u003cCOMMITTER_EMAIL\u003e`.\n\nTo show the changes on GitHub you need to:\n\n- create a new repo `yourcompany-contributions` in GitHub;\n- open folder `repo.gitlab.yourcompany.com.currentusername`;\n- add remote url `git remote add origin git@github.com:username/yourcompany-contributions.git`;\n- push changes.\n\n### Integration Tests\n\nTo run integration tests:\n\n1. Set `GITLAB_TOKEN` environment variables with the value obtained at \u003chttps://gitlab.com/-/user_settings/personal_access_tokens\u003e. Necessary scopes:\n    - `read_api`;\n    - `read_user`;\n    - `read_repository`.\n\n2. Set `GITLAB_BASE_URL` with `https://gitlab.com`.\n3. Run `make test-integration`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandear%2Fimport-gitlab-commits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandear%2Fimport-gitlab-commits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandear%2Fimport-gitlab-commits/lists"}