Imagine that your all repos are hosted on GitHub but you wanna use GitLab's CI/CD for them instead of GitHub actions. So, in today's article, I am going to show you, how we can use GitLab CICD with GitHub Repository.
Create GitHub Access Token
To connect our GitHub Repositories with GitLab, we need to create a GitHub Access Token. You should have GitHub Owner Role to perfome this action
To create a GitHub Access Token, follow the steps below:
- Go to your GitHub account and navigate to Settings->token->new
- Create a Personal Access Token
- Give it a description(optional) and update the scope to allow repo and admin:repo_hook. By allowing above scopes, GitLab can access your project, update commit statuses, and create a web hook to notify GitLab of new commits
Note: You need to store this Access Token in a safe place because we need this Token for our future steps
Create new GitLab project
Now, we need to create a new GitLab project. To create a new project, follow the steps below:
Navigate to Projects-> Create new project
Select Run CI/CD for external repository
Select GitHub as the source
Enter your GitHub Access Token
Search your GitHub Repository name and import it
Navigate to Projects-> Create new project
Select Run CI/CD for external repository
Select GitHub as the source
Enter your GitHub Access Token
Search your GitHub Repository name and import it