Contribute to Forem 🌱 in Gitpod on your own fork
Tags: forem, gitpod, opensource, contributorswanted
Published: 2020-07-27 13:34:30

To follow-up on @ben's [post](https://dev.to/ben/spin-up-a-local-instance-of-dev-in-the-cloud-with-gitpod-it-s-incredibly-simple-pij), Gitpod allows you to spin up [Forem](https://github.com/forem/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.

{% post ben/spin-up-a-local-instance-of-dev-in-the-cloud-with-gitpod-it-s-incredibly-simple-pij %}

If you already tried to spin up Forem on Gitpod as the [documentation](https://docs.forem.com/installation/gitpod/) 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.

```bash
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`.  

```bash
$ 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).

```bash 
$ 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`.

```bash
$ 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](https://dev-to-uploads.s3.amazonaws.com/i/v2xzl808z724o9305ars.gif)

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](https://dev-to-uploads.s3.amazonaws.com/i/wo2n5ttplkw56oal78y5.gif)

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](https://dev-to-uploads.s3.amazonaws.com/i/acv5tucqk2c9f5l6w47i.gif) 

# Option 3. Your fork instance on Gitpod

As explained in the [community forum](https://community.gitpod.io/t/how-to-specify-users-fork-instead-of-main-repository/639/3), 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

{% github https://github.com/forem/forem/pull/2321#issuecomment-480614021 %}

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! 

{% github https://github.com/forem/forem/issues/9195 %}

{% github https://github.com/forem/forem/issues/8849 %}

Love 🌱🌱