GitHub in Remix IDE

Filip Mertens
Remix Project
Published in
5 min readSep 17, 2021

Remix release v0.18.0 now includes full support for a plugin called dGIT that allows you to interact with GitHub as if you were doing it on your terminal or in VSCode.

It supports cloning, pushing ( with pushing with force), pulling, using branches, working with remotes & checking out previous commits & files. It also includes a nifty diff viewer.

The app does not handle more advanced tasks such as rebasing, squashing and the like. But you should find the basics to be ample.

Finding the dGIT plugin

To launch the dGIT plugin app, go to the Plugin Manager.

No Clowning — Large clones are Dangerous clones

Remix IDE operates in the browser and that is where it stores your files — unless you’re using remixd of course.

NOTE: If you use Remixd, you access a folder on your computer's hard drive and so then you don't have to worry about a repo's size.

Browser storage is limited, very limited.
Clone too large of a repo and Remix will freeze!

dGIT: specify the branchs & the depth of your clone

So if you want to use the browser’s storage (and not Remixd )— dGit has the option to specify the branches & the depth of a clone. This limits the amount of commits you import. Most of the time you’d be working on the last commit anyway, right?

So clone safe, clone carefully, and don’t clone the entire Open Zeppelin, repo! Also pick a repo that deals with solidity contracts and not an npm package.

Again, if you do happen to destroy Remix by flooding it with data it will freeze. Then the only thing you can do then is clear your local storage in your browser.

dGIT’s Browser Storage Meter

dGIT features a nice meter that shows you full is your storage.

Clean it up!

If you’re not working on a workspace remove it or push it to GitHub or IPFS for safe keeping.

For pushing and pulling, you need a P.A.T. — Personal Access Tokens

When using the dGIT plugin for pushing, pulling, accessing private repositories etc on GitHub, you need to input a GitHub personal token.

You can create such a token in your GitHub settings -> Developer settings. You will need to get a token that has REPO privileges.

Copy that token and paste it in the CONFIG sub-section of dGit’s GitHub Settings section.

As is customary when using git, you will also need to set a name and email, just like you do on the terminal or in VSCode. This will tell GitHub who is doing the commit. Easy!

Workspaces

In case you haven’t noticed, Remix uses workspaces to manage sets of files. dGIT will treat each workspace as a git repo.

When you switch workspaces & create a new one dGIT will follow and track your files.

A lesson in Git?

Here’s a basic scenario about how to use this GitHub integration.

  • You’ve created an empty git repo on GitHub, private or public.
  • You would then clone it in dGit.
  • This will automatically set the remote for you and call it ‘origin’. You can add more remotes if you need them.
  • You work on your files, stage them and commit them
  • You push to your repo

M is for Modified

dGIT tracks changes in your files in a similar way VSCode does it. If there are no changes or new, untracked files you won’t see anything.

For everything else, dGIT shows you codes which represent the status of the file:

  • M stands for Modified
  • U stands for Untracked
  • D stands for deleted

The stage is yours

By clicking on ‘Stage all’ or a plus button you can add files to the staging area.

You can also undo your changes or remove your files from staging.

The commits show the status of your repo. Mind you, if you have only cloned limited commits, this won’t be filled up with entries — but you’d still be working on the repo as it is.

Ch-ch-ch-ch-changes

If you click on any file in ‘Files’ it will either open the file in the editor or when it’s been modified open it in the diff viewer.

Interplanetary…

If you don’t care much for cloud storage or just need to publish your code in a fire-and-forget way where you don’t want to create a repo for it, you can use IPFS to publish your work.

dGIT offers the option to do this. Read more about this in this article: https://medium.com/remix-ide/interplanetary-git-in-remix-d6dc7335e436

Your feedback is most welcome

You can post your issues here:

https://github.com/bunsenstraat/remix-storage-plugin

--

--