Giter VIP home page Giter VIP logo

import-gitlab-commits's Introduction

Import GitLab Commits

Go Report Card

The tool to import commits from private GitLab to separate repo. Can be used to show your programming activity for another company in GitHub.

Check out this informative blog post on how to import GitLab commits at https://www.alexandear.tech/posts/2023-03-08-import-gitlab-commits/ for a practical use case.

Getting Started

  1. Download and install Go 1.20.
  2. Install the program by running the command in a shell:
go install github.com/alexandear/import-gitlab-commits@latest
  1. Set environment variables and run import-gitlab-commits:
export GITLAB_BASE_URL=<your_gitlab_server_url>
export GITLAB_TOKEN=<your_gitlab_token>
export COMMITTER_NAME="<Name Surname>"
export COMMITTER_EMAIL=<[email protected]>

$(go env GOPATH)/bin/import-gitlab-commits

where

  • GITLAB_BASE_URL is a GitLab instance URL, e.g. https://gitlab.com, https://gitlab.gnome.org or any GitLab server;
  • GITLAB_TOKEN is a personal access token;
  • COMMITTER_NAME is your GitHub name with surname, e.g. John Doe (can be passed to git config user.name);
  • COMMITTER_EMAIL is your GitHub email, e.g. [email protected] (valid for git config user.email);
  • $(go env GOPATH)/bin/ is the path where import-gitlab-commits installed.

Example

Contributions before running import-gitlab-commits:

After:

Internals

What work the tool does:

  • gets current user info by GITLAB_TOKEN;
  • fetches from GITLAB_BASE_URL projects that the current user contributed to;
  • for all projects fetches commits where author's email is the current user's email;
  • creates new repo repo.gitlab.yourcompany.com.currentusername and commits all fetched commits with message Project: GITLAB_PROJECT_ID commit: GITLAB_COMMIT_HASH, commit date GITLAB_COMMIT_DATE, and commit author COMMITTER_NAME <COMMITTER_EMAIL>.

To show the changes on GitHub you need to:

  • create a new repo yourcompany-contributions in GitHub;
  • open folder repo.gitlab.yourcompany.com.currentusername;
  • add remote url git remote add origin [email protected]:username/yourcompany-contributions.git;
  • push changes.

import-gitlab-commits's People

Contributors

alexandear avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.