Securing your Files in Remix & How to Clone and Push to a Git Repo

Yann Levreau
Remix Project
Published in
4 min readFeb 18, 2022

Coding in Remix IDE Online is different from writing in a Google doc. Yes, both are written in a browser but a Google doc saves your work to Google’s servers, and Remix—out of the box—only saves your code to your browser’s storage. So tread carefully, browser storage is not permanent!

If you clear your browser storage or if your browser crashes hard, you’ll lose your work. And typically browser storage is pretty limited to about 5MB. While you can pack a lot of solidity files into 5MB, you don’t want to lose your work if the browser crashes.

SPOILER ALERT: In the next Remix release, we will be using IndexedDB which greatly expands the storage capacity of the browser. And, you can use this now on https://remix-alpha.ethereum.orgSPOILER OF THE SPOILER ALERT: If you clear your storage, or if the browser crashes while using IndexedDB, you will still lose your files.

With some configuration and the terminal script, Remixd running, it is possible to save your work directly to your computer’s hard drive. This article does not cover Remixd. For more info, go the Remixd docs.

Avoid losing your work— USE THE DGIT PLUGIN!

The DGit plugin allows you to PUSH as well as all the other Git operations that you are used to, plus a few you are probably not used to.

This post is a short tutorial on how to use the DGit plugin to push and secure your files in GitHub.

Setup, Clone, and Push

  1. Go to the Plugin Manager in Remix and activate the DGit plugin

2. Click on the DGIT icon to display its UI.

Here are some more details about a few of these sections:

  • SOURCE CONTROL: Stage, unstage, and commit your files. It is also possible to display a diff by clicking on the file name.
  • CLONE, PUSH, PULL & REMOTES: Clone, push, and add a remote repository
  • GITHUB SETTINGS: Set your GitHub token, name, and email to push/pull and clone private repositories
  • COMMITS: Display the commits (you can also checkout a commit from here)
  • BRANCHES: Create a branch and checkout a branch
  • IPFS EXPORT/IMPORT/SETTINGS: Clone or push to an IPFS server instead of GitHub

3. Expand the GitHub section, put the URL of the repository, and click on CLONE to clone it. If you want to Push it later, clone a repo that you have the rights to push to.

4. A new workspace is created with the cloned repository.

5. To make a new branch: In the BRANCHES section, create a new branch by naming it in the branch name text box, then click the git branch button. Then hit the Checkout button next to it to check it out. The workspace is now tied to this new branch.

6. Before you push to your remote repo: you need to specify a personal access token, name, and email to identify your account to the GitHub platform.

7. Before you push (one more thing): make sure you are going to push to the right remote. In the GITHUB section, check that the repo you want to push to is the one selected in the AVAILABLE REMOTES subsection. If it is not yet there, add it in the GIT REMOTE section.

8. Now click push.

At this point you can go to the repo on GitHub and create a Pull Request.

9. Now edit some code: go the FILES EXPLORER, choose a file and add to it in the editor. Then come back to the DGit plugin. Expand the SOURCE CONTROL section. From here you can stage the file (AKA “add”), rollback the changes, see the diff and commit. Once it’s committed, go back to the GITHUB section and push again (same as step 8). The changes are also visible in the pull request — just like usual.

For more info about the Remix DGit plugin also check this article.

Ok that’s it! I hope you liked this short post. You can reach us on Twitter, Gitter, or via email (remix@ethereum.org) or Discord.

We would really like your feedback on this! For future releases, we are looking for Beta Testers. If you are interested in helping this effort please fill out this questionnaire.

Hope to hear from you soon!

--

--