You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tool to import commits from private GitLab to separate repo. Can be used to show your programming activity for another company in GitHub.
5
+
This tool imports commits from a private GitLab repository to a separate repository.
6
+
It can be used to showcase your programming activity for another company on GitHub.
6
7
7
-
Check 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/).
8
+
Check out this informative blog post for a practical use case on how to import GitLab commits
<imgalt="Screenshot of GitHub contributions graph after running import-gitlab-commits with a lot of activity"src="screenshots/contribs_after_dark.png"width="1000">
27
+
</picture>
8
28
9
29
## Getting Started
10
30
11
31
1. Download and install [Go](https://go.dev/dl/).
12
-
2. Install the program by running the command in a shell:
32
+
2. Install the program by running the following command in a shell:
13
33
14
34
```shell
15
35
go install github.com/alexandear/import-gitlab-commits@latest
@@ -26,57 +46,40 @@ Check out this informative blog post for a practical use case on how to import G
26
46
$(go env GOPATH)/bin/import-gitlab-commits
27
47
```
28
48
29
-
where
49
+
Where:
30
50
31
-
- `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;
32
-
- `GITLAB_TOKEN` is a personal [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token);
33
-
- `COMMITTER_NAME` is your GitHub name with surname, e.g. `John Doe` (can be passed to `git config user.name`);
34
-
- `COMMITTER_EMAIL` is your GitHub email, e.g. `[email protected]` (valid for`git config user.email`);
35
-
- `$(go env GOPATH)/bin/` is the path where `import-gitlab-commits` installed.
36
-
37
-
## Example
38
-
39
-
Contributions before running `import-gitlab-commits`:
<img alt="Screenshot of GitHub contributions graph after running import-gitlab-commits with a lot of activity" src="screenshots/contribs_after_dark.png" width="1000">
53
-
</picture>
51
+
- `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),
52
+
e.g., `https://gitlab.com`, `https://gitlab.gnome.org`, or any GitLab server.
53
+
- `GITLAB_TOKEN` is a personal [access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token).
54
+
- `COMMITTER_NAME` is your GitHub name with surname, e.g., `John Doe` (can be passed to `git config user.name`).
55
+
- `COMMITTER_EMAIL` is your GitHub email, e.g., `[email protected]` (valid for`git config user.email`).
56
+
- `$(go env GOPATH)/bin/` is the path where `import-gitlab-commits` is installed.
54
57
55
58
## Internals
56
59
57
-
What work the tool does:
60
+
What the tool does:
58
61
59
-
- gets current user info by`GITLAB_TOKEN`;
60
-
- fetches from `GITLAB_BASE_URL`projects that the current user contributed to;
61
-
- for all projects fetches commits where author's email is the current user's email;
62
-
- creates new repo`repo.gitlab.yourcompany.com.currentusername` and commits all fetched commits with message
63
-
`Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH`, commit date `GITLAB_COMMIT_DATE`, and commit author `COMMITTER_NAME <COMMITTER_EMAIL>`.
62
+
- Retrieves current user info using`GITLAB_TOKEN`.
63
+
- Fetches projects from `GITLAB_BASE_URL` that the current user contributed to.
64
+
- For all projects, fetches commits where the author's email matches the current user's email.
65
+
- Creates a new repository`repo.gitlab.yourcompany.com.currentusername` and commits all fetched commits with the message:
66
+
`Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH`, commit date `GITLAB_COMMIT_DATE`, and commit author `COMMITTER_NAME <COMMITTER_EMAIL>`.
64
67
65
-
To show the changes on GitHub you need to:
68
+
To display the changes on GitHub, you need to:
66
69
67
-
- create a new repo`yourcompany-contributions`in GitHub;
68
-
- open folder `repo.gitlab.yourcompany.com.currentusername`;
- Create a new repository`yourcompany-contributions`on GitHub.
71
+
- Open the folder `repo.gitlab.yourcompany.com.currentusername`.
72
+
- Add the remote URL:`git remote add origin [email protected]:username/yourcompany-contributions.git`.
73
+
- Push the changes.
71
74
72
75
### Integration Tests
73
76
74
77
To run integration tests:
75
78
76
-
1. Set `GITLAB_TOKEN` environment variables with the value obtained at <https://gitlab.com/-/user_settings/personal_access_tokens>. Necessary scopes:
77
-
- `read_api`;
78
-
- `read_user`;
79
-
- `read_repository`.
79
+
1. Set the `GITLAB_TOKEN` environment variable with the value obtained at <https://gitlab.com/-/user_settings/personal_access_tokens>. Necessary scopes:
0 commit comments