FREE Storage in Replit via Google Drive and Onedrive

Is your storage filling up?

If so, don’t worry about deleting all of your repls just yet. With this guide, you will be able to connect Google Drive or Onedrive to a Repl, and learn how to use the remote drive connection.

Install

First, place these two packages into your replit.nix file:
replit.nix:pkgs.rclone
pkgs.firefox-esr

Preparation

To activate the GUI “Output” tab, just type in firefox into the Shell, press enter, and then press CTRL - C to stop firefox once the Output tab pops up with a firefox window. You will need this if you want to sign in through the repl firefox browser.

Configuration

Now, enter rclone config into the shell, and then press enter.

Current remotes:

Name                 Type
====                 ====
gdrive               drive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> 

Input n to create a new remote.
Once asked for a name, you can call it anything you want, but try to make it short and memorable.
Now, you must choose the target file host to use. In this guide, I will introduce both Google Drive 18 and Microsoft Onedrive 31, but I have attached more tips further into this article.

WARNING:DO NOT use an account that contains personal or confidential information, but instead use a new burner account that you don’t mind losing for all interactions with Replit, as the hosted repl is not as isolated as your own computer and anyone can fork it to try to hack into your account.

Google Drive 15 GB

If you have a google account with no important files in your Google Drive, then this option is for you. If you don’t have a google account, then you can create one for free at accounts.google.com/AccountChooser.

To proceed with google drive, input 18 into the program when prompted for the type of storage you will be using.
Now, you will have the option to generate your own Client ID to have your own rate limits (the current one is 10 queries per second).

How to generate your own Client ID

To use the default client ID, press ENTER 2 times, both for the client ID and the client secret.
Now input your desired permission level (1 if you are going to be writing files, 2 if you are only going to be reading files).
When it prompts you for a service account path, you can press enter to use interactive login, unless you have downloaded the service account JSON while setting up your own google client ID. If that is the case, then you can upload the account to replit, use the path ~/${REPL_SLUG}/path/to/service_account.json.

After that, IMMEDIATELY DELETE YOUR SERVICE ACCOUNT FILE!

WARNING: A service account JSON file is essentially your account password. KEEP IT SAFE, and DO NOT KEEP IT IN THE REPL!

WARNING:DO NOT use an account that contains personal or confidential information, but instead use a new burner account that you don’t mind losing for all interactions with Replit, as the hosted repl is not as isolated as your own computer and anyone can fork it to try to hack into your account.

You don’t need advanced configuration, so you can safely input n.
Now, there are two different ways to provide authentication. The first way is the easiest, while the second is more secure.

First method

With the “Output” tab open from the Preparation step, input y into the Shell to use auto config. A browser window (the firefox installation tested before) might pop up, but if the screen remains black, then you can manually open the link by first copying the link (which looks like http​://127.0.0.1:xxxxx/auth?state=xxxxxxxxx_xxxxxxxxxx), selecting Shell under the Tools section, right below the Files pane, and then entering firefox"http://mylink" (or firefox --private-window "http://mylink" to use incognito), where http://mylink is the link that you copied earlier.
Now, log into google through the firefox browser in the Output tab, and complete the sign in process until you get a confirmatory message telling you that the authentication was successful. You might have to verify your identity through a verification text message or a verification code, as the replit servers are deemed as suspicious activity to the google servers.

Second method

If you don’t want to enter your google account password into replit, then you can use your own computer (such as a laptop or a PC with a display) to do the auth for you. To do so, you must select n for auto config. It will now ask you to use another computer to run an RClone command. You must first install RClone on your computer, and then run the respective executable in the download folder (once you unzip the .zip archive to reveal the expanded folder).

Mac

Right click on the file that says rclone, and then click on New Terminal Window Here.


Then, enter the command shown in the Replit Shell tab, but prefixed by ./. you final command might look like ./rclone authorize “mydrive” “xxxxxxxxxxxxxxxxxxxxxxxxxxxx”.

Windows

Double click on rclone.exe in the expanded archive to run the executable.
NOTE: I am not that experienced with windows, so I cannot help you with windows OS problems. To resolve a windows issue or to ask a question, please contact a member of this community who has experience with windows and can install rclone.

Linux

Open a new terminal window (CTRL - ALT - T), and then change-dir into your download path. This is entirely dependent on the location of your downloaded ZIP file and the location of the expanded folder. For example, your command to do this might look like cd ~/Downloads/rclone-v1.63.1-linux-amd64/.
Then, enter the command shown in the Replit Shell tab, but prefixed by ./. you final command might look like ./rclone authorize “mydrive” “xxxxxxxxxxxxxxxxxxxxxxxxxxxx”.

Then…

After you have logged into Google, the console should now show an authorization code. Copy it into the replit shell, check if you have copied the right thing, and then press enter. It should prompt you for confirmation, press yes, and then press Q once at the main menu to exit setup.

I will cover how to use RClone further into the article.

Microsoft Onedrive 5 GB

To proceed with Onedrive, make sure that you have a microsoft account. If not, sign up for one: https://account.microsoft.com/account/Account
Afterwards, input 31 to select Microsoft Onedrive.
Leave client ID and client secret empty, as those are not needed.
Select option 1 for almost all use cases, unless you are using a US government account, a Microsoft Germany account, or Azure and Office 365 operated by the VNet group in China.
You don’t need advanced configuration, so you can safely input n.
Now, there are two different ways to provide authentication. The first way is the easiest, while the second is more secure.

First method

With the “Output” tab open from the Preparation step, input y into the Shell to use auto config. A browser window (the firefox installation tested before) might pop up, but if the screen remains black, then you can manually open the link by first copying the link (which looks like http​://127.0.0.1:xxxxx/auth?state=xxxxxxxxx_xxxxxxxxxx), selecting Shell under the Tools section, right below the Files pane, and then entering firefox"http://mylink" (or firefox --private-window"http://mylink" to use incognito), where http://mylink is the link that you copied earlier.
Now, log into microsoft through the firefox browser in the Output tab, and complete the sign in process until you get a confirmatory message telling you that the authentication was successful. You might have to verify your identity through a verification text message or a verification code, as the replit servers are deemed as suspicious activity to the microsoft authentication servers.

Second method

If you don’t want to enter your microsoft account password into replit, then you can use your own computer (such as a laptop or a PC with a display) to do the auth for you. To do so, you must select n for auto config. It will now ask you to use another computer to run an RClone command. You must first install RClone on your computer, and then run the respective executable in the download folder (once you unzip the .zip archive to reveal the expanded folder).

Mac

Right click on the file that says rclone, and then click on New Terminal Window Here.


Then, enter the command shown in the Replit Shell tab, but prefixed by ./. you final command might look like ./rclone authorize “mydrive” “xxxxxxxxxxxxxxxxxxxxxxxxxxxx”.

Windows

Double click on rclone.exe in the expanded archive to run the executable.
NOTE: I am not that experienced with windows, so I cannot help you with windows OS problems. To resolve a windows issue or to ask a question, please contact a member of this community who has experience with windows and can install rclone.

Linux

Open a new terminal window (CTRL - ALT - T), and then change-dir into your download path. This is entirely dependent on the location of your downloaded ZIP file and the location of the expanded folder. For example, your command to do this might look like cd ~/Downloads/rclone-v1.63.1-linux-amd64/.
Then, enter the command shown in the Replit Shell tab, but prefixed by ./. you final command might look like ./rclone authorize “mydrive” “xxxxxxxxxxxxxxxxxxxxxxxxxxxx”.

Then…

After you have logged into Microsoft, the console should now show an authorization code. Copy it into the replit shell, check if you have copied the right thing, and then press enter.
Then, it will ask you for the type of drive connection. For free onedrive users, select option 1 to access your onedrive files. If you have another configuration or are using a paid version of Microsoft, then you might have access to the other connection types and are daring enough to configure RClone using the advanced options.
Assuming that you chose option 1, choose your personal drive, which is most likely to be option 1. Then confirm your choices by entering y two times, and then press Q to exit setup.

Others ~5 GB

As this section is not product-specific, I will give you tips on how to use configure your selected service.

  1. Google the service, and check it’s Pricing page to see its Free plan’s features, including the disk quota and other limits.
  2. Do not fill in client ID and client secret, unless you are a developer of a verified OAuth2 application on the specified platform.
  3. You don’t need advanced configuration. Seriously, don’t make your life difficult.
  4. Use auto config if you are willing to sign in through the repl’s firefox window.
How to use Auto Config with Firefox

With the “Output” tab open from the Preparation step, input y into the Shell to use auto config. A browser window (the firefox installation tested before) might pop up, but if the screen remains black, then you can manually open the link by first copying the link (which looks like http​://127.0.0.1:xxxxx/auth?state=xxxxxxxxx_xxxxxxxxxx), selecting Shell under the Tools section, right below the Files pane, and then entering firefox"http://mylink" (or firefox --private-window"http://mylink" to use incognito), where http://mylink is the link that you copied earlier.

  1. Even if you aren’t using Google Drive or Microsoft Onedrive, try to follow along, because each option has similar configuration settings, and it shouldn’t be too hard to guess the required settings for a slightly different service.

How to use RCloud

You can use rcloud like so:

rclone ls onedrive:
ls /

rclone cat veryoriginalname:hello.txt
cat /hello.txt

rclone mkdir mygoogledrive:Folder
mkdir /Folder

rclone rmdir mygoogledrive:Folder
rmdir /Folder

rclone ncdu
# Interactive file explorer

rclone mount onedrive: /etc/onedrive # Doesn't work on replit
#OR
rclone cmount onedrive: /etc/onedrive # Doesn't work on replit
# No equivalent

rclone move #...
mv #...

# ETC you get the idea
Usage:
  rclone [flags]
  rclone [command]

Available Commands:
  about           Get quota information from the remote.
  authorize       Remote authorization.
  backend         Run a backend-specific command.
  bisync          Perform bidirectional synchronization between two paths.
  cat             Concatenates any files and sends them to stdout.
  check           Checks the files in the source and destination match.
  checksum        Checks the files in the source against a SUM file.
  cleanup         Clean up the remote if possible.
  cmount          Mount the remote as file system on a mountpoint.
  completion      Generate the autocompletion script for the specified shell
  config          Enter an interactive configuration session.
  copy            Copy files from source to dest, skipping identical files.
  copyto          Copy files from source to dest, skipping identical files.
  copyurl         Copy url content to dest.
  cryptcheck      Cryptcheck checks the integrity of a crypted remote.
  cryptdecode     Cryptdecode returns unencrypted file names.
  dedupe          Interactively find duplicate filenames and delete/rename them.
  delete          Remove the files in path.
  deletefile      Remove a single file from remote.
  genautocomplete Output completion script for a given shell.
  gendocs         Output markdown docs for rclone to the directory supplied.
  hashsum         Produces a hashsum file for all the objects in the path.
  help            Show help for rclone commands, flags and backends.
  link            Generate public link to file/folder.
  listremotes     List all the remotes in the config file.
  ls              List the objects in the path with size and path.
  lsd             List all directories/containers/buckets in the path.
  lsf             List directories and objects in remote:path formatted for parsing.
  lsjson          List directories and objects in the path in JSON format.
  lsl             List the objects in path with modification time, size and path.
  md5sum          Produces an md5sum file for all the objects in the path.
  mkdir           Make the path if it doesn't already exist.
  mount           Mount the remote as file system on a mountpoint.
  move            Move files from source to dest.
  moveto          Move file or directory from source to dest.
  ncdu            Explore a remote with a text based user interface.
  obscure         Obscure password for use in the rclone config file.
  purge           Remove the path and all of its contents.
  rc              Run a command against a running rclone.
  rcat            Copies standard input to file on remote.
  rcd             Run rclone listening to remote control commands only.
  rmdir           Remove the empty directory at path.
  rmdirs          Remove empty directories under the path.
  selfupdate      Update the rclone binary.
  serve           Serve a remote over a protocol.
  settier         Changes storage class/tier of objects in remote.
  sha1sum         Produces an sha1sum file for all the objects in the path.
  size            Prints the total size and number of objects in remote:path.
  sync            Make source and dest identical, modifying destination only.
  test            Run a test command
  touch           Create new file or change file modification time.
  tree            List the contents of the remote in a tree like fashion.
  version         Show the version number.

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.

Final words

Overall, I hope you all have enjoyed my complete guide on getting free storage in replit. This took me several hours to write, so please consider leaving a like, posting a reply, or (better yet) sharing this guide to spread this knowledge to more members of the community.

LEGAL DISCLAIMER

TL,DR; USE COMMON SENSE, AND DON’T BLAME ME FOR ANY PROBLEMS.

By accessing or using this guide, you acknowledge and agree to the following terms and conditions. Please read this disclaimer carefully before proceeding.

  1. No Liability for Actions: The information and content provided in this guide are intended for general informational purposes only. The author, python660, and any affiliated individuals or entities, hereby referred to as “we” or “us,” shall not be held liable for any actions taken or decisions made by users based on the information provided in this guide. Users are solely responsible for their actions, and we disclaim any responsibility for the consequences of such actions.
  2. Not Professional Advice: The information presented in this guide is not intended to serve as professional advice. While we strive to provide accurate and up-to-date information, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability of the information, products, services, or related graphics contained in the guide. Any reliance you place on such information is at your own risk.
  3. Use at Your Own Risk: You agree that your use of this guide and any information contained herein is entirely at your own risk. We shall not be liable for any direct, indirect, incidental, consequential, or punitive damages arising out of your access to, use of, or reliance on the information contained in this guide. This includes, but is not limited to, any loss of data, profit, or business interruption, regardless of the cause.
  4. No Warranty: We do not warrant that this guide will be continuously available, error-free, or free of viruses or other harmful components. We disclaim all warranties, express or implied, including but not limited to, implied warranties of merchantability and fitness for a particular purpose.
  5. External Links: This guide may contain links to external websites or resources that are not under our control. We are not responsible for the content of any linked site. The inclusion of any link does not imply endorsement by us. We shall not be liable for any damages or losses incurred due to your use of any linked website.
  6. Compliance with Laws: Users are responsible for complying with all applicable laws, regulations, and guidelines in their jurisdiction. We do not condone or encourage any illegal or unethical activities, and users must ensure their actions are in accordance with the law.
  7. Changes to Disclaimer: We reserve the right to modify, amend, or update this disclaimer at any time without prior notice. It is your responsibility to review this disclaimer periodically for any changes. Your continued use of this guide after any modifications constitute your acceptance of the revised disclaimer.

By accessing and using this guide, you acknowledge that you have read, understood, and agreed to be bound by the terms and conditions stated in this disclaimer. If you do not agree with any part of this disclaimer, please refrain from using this guide.

BTW could someone make this a wiki/guide?

10 Likes

You should probably put that service account file’s data in secrets and write it to a file in /tmp when your repl starts :eyes:

5 Likes

yes that is true, but the service account is only needed at startup IIRC (I might be wrong, who knows). however that is also true via the onboot property in .replit

Also, I just realized that I basically voluntarily wrote an block of words longer than the requirement of a college essay.

1 Like

Still, you should never put credentials in a public repl. Most users are too lazy to make things secure if you don’t tell them how, so it’s good to only provide a method that doesn’t put someone’s account at risk.

4 Likes

You’re right; I should put that in now.

Amazing guide! Would it be possible to connect replit to store files on your own computer?
I still have to delete ~100 repls though. At least it’s not like @techwithanirudh who has ~7k repls.

2 Likes

on your own computer… you have to set up an SFTP server and use the sftp option instead (unless you have another protocol). I can explain tomorrow.

Wow! This guide is so long that I’m too lazy to read it to the end!

2 Likes

Claim your “I made it to the end” ticket here:

  • I made it!
0 voters

EDIT: should have done this earlier

2 Likes