Forking Git repository from GitHub to GitLab
Solution 1:
If you just want to track changes, first make an empty repository in GitLab (or whatever else you may be using) and clone it to your computer.
Then add the GitHub project as the "upstream" remote with:
git remote add upstream https://github.com/user/repo
Now you can fetch and pull from the upstream should there be any changes. (You can also push or merge to it if you have access rights.)
git pull upstream master
Finally, push back to your own GitLab repository:
git push origin master
If you don't want to manually pull upstream/push origin, GitLab offers a mirroring ability in Settings => Repository => Mirroring repositories.
Solution 2:
The browser-only way:
- Create a new project in Gitlab (Just an empty project with a name is fine)
- Go to Settings -> Respository
- Enter GitHub URL under 'Mirroring repositories'
- Make sure 'Mirror direction' is 'Pull'
- Press 'Mirror repository' button
- Press the sync icon next to the entry that appears
Solution 3:
Instead of forking, you can import any publicly available GitHub repository using only the web interface:
- From your GitLab dashboard click New project
- Switch to the Import project tab
- Click on the Repo by URL button
- Fill in the "Git repository URL" and the remaining project fields
- Click Create project to begin the import process
- Once complete, you will be redirected to your newly created project
Used this technique recently, and it works on any public repository even without a GitHub account. See this GitLab docs page for the source of info.