Using GitLab CI/CD with a GitHub repository
GitLab CI/CD can be used with GitHub.com and GitHub Enterprise by creating a CI/CD project to connect your GitHub repository to GitLab.
Watch a video on Using GitLab CI/CD pipelines with GitHub repositories.
Connect with Personal Access Token
Personal access tokens can only be used to connect GitHub.com
repositories to GitLab, and the GitHub user must have the .
To perform a one-off authorization with GitHub to grant GitLab access your
repositories:
GitLab:
To use GitHub Enterprise with GitLab.com, use this method.
To manually enable GitLab CI/CD for your repository:
In GitHub, from Settings > Webhooks, create a web hook to notify GitLab of
new commits.
The web hook URL should be set to the GitLab API to
trigger pull mirroring,
using the GitLab personal access token we just created:
Select the Let me select individual events option, then check the Pull requests and Pushes checkboxes. These settings are needed for pipelines for external pull requests.
.gitlab-ci.yml
to configure GitLab CI/CD.
Connect manually
API
scope to
authenticate the GitHub web hook notifying GitLab of new commits.
https://gitlab.com/api/v4/projects/<NAMESPACE>%2F<PROJECT>/mirror/pull?private_token=<PERSONAL_ACCESS_TOKEN>
.gitlab-ci.yml
to configure GitLab CI/CD.