Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I submit a pull request from GitLab.com to GitHub?

Most of our work occurs on GitLab.com (i.e. not a local GitLab installation). If the upstream repo resides on GitHub, is there a way to submit a pull request to upstream? (If forking the upstream repo in a particular way is part of solution, that's ok.)

like image 940
lofidevops Avatar asked Jun 07 '16 07:06

lofidevops


People also ask

Can GitHub and GitLab work together?

Yes you can, you can share the same key between them both (ssh key) or create a new one per git server.

How do I link a pull request to GitHub?

Manually linking a pull request to an issue The issue and pull request must be in the same repository. On GitHub.com, navigate to the main page of the repository. Under your repository name, click Pull requests. In the list of pull requests, click the pull request that you'd like to link to an issue.


3 Answers

No. The correct workflow would be forking the upstream project on GitHub to your own namespace. Then use your fork as upstream in your GitLab repository not the origin of your fork.

From your GitLab repository you are then pushing changes to your fork (upstream). Then on GitHub you can submit a pull request from your GitHub fork to the origin.

like image 194
Kai Avatar answered Sep 30 '22 06:09

Kai


Nope, there's no way to do this with Microsoft GitHub.

Instead, you'll need to:

  1. Create a GitHub repository
  2. Add the GitHub remote:
    • SSH: git remote add gh [email protected]:org/repo.git
    • HTTPS: git remote add gh https://github.com/org/repogit
  3. git push gh master
  4. Create the pull request from your GitHub repository.
like image 41
christianbundy Avatar answered Sep 27 '22 06:09

christianbundy


This is weird but this is how I do it!

I have a repository on Github but I wanted to use the Gitlab CI, so I mirrored the repository from Github to Gitlab, then I configured the CI etc... I was looking around online, and I found that with Gitlab Enterprise you have the feature of pushing changes to an external repository from GitLab, but since I don't pay for Gitlab Enterprise, I did the following:

Since we are using GIT, and we are good programmers try to be good programmers make it work, so:

I JUST EDITED THE GIT URL

How was it?

  • Clone your repository
  • Go to your project ...
  • Navigate to .git > config and you should have something like this:

    .git/config file

Change the URL from Github to Gitlab (I had the same username and project name, in both services so, I only changed the URL).

Then, with the Gitlab URL:

$ git pull origin

Since the remote URL have changed, you should get the changes from Gitlab.

  • Change again your remote URL back again to Github

Then push your changes:

$ git push origin

You should be done! Hope it works for you, it worked for me! 🧐

like image 40
abranhe Avatar answered Sep 27 '22 06:09

abranhe