loading...
Cover image for Contribute to Forem 🌱 in Gitpod on your own fork

Contribute to Forem 🌱 in Gitpod on your own fork

bogdaaamn profile image Bogdan Covrig ・3 min read

To follow-up on @ben 's post, Gitpod allows you to spin up Forem's codebase on the cloud and makes it available to you in the browser. Really, a fully working local instance in your browser. Within minutes.

If you already tried to spin up Forem on Gitpod as the documentation describes, most probably you couldn't push the changes. That is perfectly normal; contributors are not allowed to (and they shouldn't) push changes directly into the original repo.

remote: Permission to forem/forem.git denied to BogDAAAMN.
fatal: unable to access 'https://github.com/forem/forem/': The requested URL returned error: 403

The solution is to push the changes to your Forem fork instead. The fastest way to do that is to change the origin of the project. Gitpod allows that in a bunch of ways.

Option 1. Good old git remote

If you take a quick look at the remote right after Gitpod's initialization, the origin is pointing to the Forem repository. If you push now, naturally, the changes go to the origin.

$ git remote -v
origin  https://github.com/forem/forem.git (fetch)
origin  https://github.com/forem/forem.git (push)

To work this out, fire up a terminal in Gitpod and set the origin to your Forem fork (assuming you already have one).

$ git remote set-url origin https://github.com/<YOUR_USERNAME>/forem
$ git remote -v
origin  https://github.com/<YOUR_USERNAME>/forem.git (fetch)
origin  https://github.com/<YOUR_USERNAME>/forem.git (push)

Cool, from now on you will push your commits to the new origin – your fork.

You still need to add the Forem repository as upstream because you will need to pull and fetch the latest changes from forem/forem.

$ git remote add upstream https://github.com/forem/forem
$ git remote -v
origin    https://github.com/<YOUR_USERNAME>/forem.git (fetch)
origin    https://github.com/<YOUR_USERNAME>/forem.git (push)
upstream  https://github.com/forem/forem.git (fetch)
upstream  https://github.com/forem/forem.git (push)

Option 2. Gitpod UI

A visual approach to changing the origin to your fork is to use the Gitpod UI Git panel (left side toolbar). Click on the Git button. If the remote repository is set to forem/forem and you don't have the right to push changes, a yellow warning will appear stating that You don't have push permissions for forem/forem.

A quick fix is to click on the Fork button.

Gitpod Git panel

Gitpod's command palette will pop up, asking you to Switch to existing fork.

If you didn't fork the Forem repo yet, you will have to provide access to Gitpod to create one. Then you will be able to switch to the freshly created one.

Gitpod Command Pallete

Cool, now wait for confirmation. Once the prompt (bottom right-hand side) says that the remote was successfully changed to your fork, you are good to go! Gitpod took care of changing the remote of the repo for you.

Gitpod Confirmation Prompt

Option 3. Your fork instance on Gitpod

As explained in the community forum, Gitpod will fire up any repository URL you provide.

If you already forked Forem, you can simply paste your repo URL into https://gitpod.io/#<URL>. Gitpod will clone your fork and spin up the Forem local instance in your browser.

https://gitpod.io/#https://github.com/<YOUR_USERNAME>/forem

Finale

Comment for #2321

This is absolutely amazing, I've been dreaming of making this happen.

@jankeromnes just sign the CLA and this is good to go.

I absolutely love Gitpod for removing a lot of friction from running Forem on my machine. Pretty awesome how it makes it possible to fiddle with the code within minutes. It helps a lot if you always mess up trying to install the right Ruby version locally :)

However, there are still issues and bugs that the community encountered while trying to work on Gitpod. Fell free to Pull Request along!

continue button on ¨onboarding welcome message¨ is not working #9195

Issue: continue button on ¨onboarding welcome message¨ is not working

Platform: Gitpod Oauth: Github

Did I miss configuring something?

Incorrect node version used in GitPod #8849

Describe the bug Creating a new GitPod instance leads to a bug where under gem install solargraph; bin/setup && bin/startup the bin/setup script fails at yarn install due to incorrect node version being used (which is 12.18.x).

The GitPod Dockerfile does handle the installation of nvm and correct node version, but forgets to switch to the correct node version (12.16.3).

To Reproduce

  1. Create a GitPod Workspace with https://gitpod.io/#https://github.com/thepracticaldev/dev.to
  2. Wait till bundle install finishes in the third workspace/dev.to tab completes.
  3. Yarn throws the error as indicated in screenshot below.

Expected behavior Correct node version is selected in nvm, which allows the yarn install command to complete successfully.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Edge
  • Version: 83

Additional context The nvm use command can be of help.

Love 🌱🌱

Posted on by:

Discussion

markdown guide
 

TIL GitPod also has a UI option for it, I always used to follow the Good old git remote way.

As Nick suggested, this would be a fantastic addition to the currently minimal GitPod docs. It is such a blessing for beginners. Yesterday only, I ended up suggesting GitPod route to someone who was having troubles with the docker install.

 

Oh yeah, absolutely! I would recommend it in a heartbeat as well.

I will also try to get around issue #9195 this weekend, to make it fully usable.

continue button on ¨onboarding welcome message¨ is not working #9195

Issue: continue button on ¨onboarding welcome message¨ is not working

Platform: Gitpod Oauth: Github

Did I miss configuring something?

 

Great write up Bogdan and it was a lot of fun pairing in the workshop! It would be great to add to the documentation how to use your fork in GitPod so that it's easier to contribute.

 

Thanks, Nick! A lot of fun indeed, and a lot of inspiration for future PRs and articles!!

Of course, will write it down in the docs this week!

 

Great post! (I might be a little biased though bc I work for Gitpod.io ¯_(ツ)_/¯) To further improve the Forem Set-up, Cornelius committed yesterday the following PR that prebuilds the repo on each commit (similar to a CI server) for Forem (github.com/forem/forem/pull/9560). Which means you can immediately start contributing/reviewing/getting creative w/o having to wait for builds to complete once you start Gitpod from any branch/PR :)

 

Thank you for the heads up!! That is super awesome and so much needed 🙌🏻

I will give it a spin soon!