Update from from GitHub - using rsync or similar instead of import

I love the ‘Import from GitHub’ feature! It works super well for keeping group student projects together in both places. I’ve now just run into the issue that one project is larger in filesize than I’d like (they still need to do some image optimization) – so when loading new changes, one has to wait for the entire github directly to be copied and replace the Glitch project contents. This seems like a big waste if I just need to reload a few small files.

I see that rsync is available in the glitch terminal – is this a viable alternative? I’ll do some tests, but does anyone have experience using this instead? Or doing an rsync from their local folder to glitch (is that a thing??). If rsync from GitHub to glitch was an option – then it would probably save LOTS of resources across all users, if there was an option to ‘Update’ from GitHub next ot the Import button.

rsync from inside the Glitch project works fine if you have a server set up.

I wrote a tool to connect rsync from a desktop to a Glitch project

https://snail-cli.glitch.me/help/rsync.html

It’s kind of wasteful with RAM while transferring large files though.

3 Likes

Great, I’ll have to do some experimenting within a glitch project (was curious if GitHub would work, but I’ll just have to guess and check in a practice project).

Wow - this looks wild and very practical to sync from desktop!
Will give it a test too and am guessing much of the src has to with auth/tokens for accessing glitch?

Small update – solved my issue to sync from a github repo (only adding changed files) by doing the following with git instead of rsync (inspired by this SO):

Open Glitch project in edit mode, select ‘Terminal’, enter the following commands:

  • git init
  • git remote add origin path_to_repo.git
  • git fetch
  • git checkout origin/main -ft
  • refresh (to see changes)

For all future synced updates:

  • git pull

If changing the GitHub directory/project for that URL:

  • git remote set-url origin new_path_to_repo.git
  • git remove -v (to confirm correct path)
  • git pull (initial grab of new path)
  • git reset --hard origin/main (overwrite existing dir/git)
  • git pull (set again… )
  • refresh (update file listing)

This is surely obvious for those really comfortable with git (i’m pretty n00bish for CLI usage of git) and i’m sure some of those lines above can be compressed into 1 liners – but hopefully this helps anyone syncing a larger folder on glitch.com to avoid having to overwrite all files on every update. Again, would be awesome if there was an ‘update’ button next to ‘import’…

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.