Glitch GitHub import as restore: does it overwrite or preserve .env secrets and uploaded assets?
0 reputation · 13 Apr 2024, 12:36 UTC
0 reputation · 13 Apr 2024, 12:36 UTC
I want to use Glitch's documented GitHub export/import feature as a backup-and-restore path for a project's source, and I need to know exactly what state a re-import recovers before I rely on it.
Export to GitHub captures the project file tree, but my understanding is that .env secrets are typically excluded from the repository, and uploaded assets live on CDN URLs tracked in metadata such as .glitch-assets rather than as binaries in the repo. That leaves the core restore semantics unclear: when I import the repository back into a project that already has modified .env values and deleted assets, does the import act as an authoritative overwrite of project state, or does it merge and preserve current secrets and asset references?
I plan to verify in a disposable project with a throwaway secret and one small test asset, since feature availability may differ by project type and the current product behavior needs confirmation.
.env contents, leave them untouched, or merge keys?30275 reputation · 13 Apr 2024, 18:15 UTC
Importing a GitHub repository into a Glitch project is a source-file restore, not a project-state restore. Files present in the repository overwrite their counterparts in the project. Anything the repository does not contain — the .env file and the uploaded-asset store — is left as it is. A re-import therefore does not revert secrets you changed after export, and it does not delete or re-upload assets you removed.
| Item | In GitHub export? | Effect on import |
|---|---|---|
| Source files | Yes | Overwritten by repo version |
.env | Normally no | Untouched; current values kept |
| Uploaded binaries | No | Untouched; CDN URLs unchanged |
Asset metadata (e.g. .glitch-assets) | No | Untouched |
| File deleted in project but still in repo | Yes | Recreated |
If the repository contains a .env — because it was committed manually or the ignore rule was changed — the import treats it like any other file and overwrites the project's .env. Check before importing:
git ls-files -- .env
git log --oneline -1 -- .envEmpty output from the first command means the secret was never versioned, so the import has nothing to overwrite it with.
Uploaded files live in the project's asset store, referenced by metadata that maps asset records to CDN URLs. The GitHub export does not carry the binaries. After a round trip, an asset still present in the project keeps serving from its original URL; one you deleted stays deleted, because the import has no binary to restore. Asset references in your source can therefore point at URLs that no longer resolve — that is drift, not an import failure.
TEST_SECRET=one to .env, upload a small text file, and note its URL.TEST_SECRET=two, add a second key, and delete the uploaded asset..env: if it still reads two plus your extra key, secrets were preserved. Check the asset URL: if it no longer resolves, the deletion was preserved..env appeared from the repository.There is no documented import option that replaces hosted state. To get that behaviour you must clear the state yourself first: remove the keys you want reverted from .env, delete the assets you want gone, then import. Keep secrets in a dedicated secret manager or encrypted backup, because the repository is not a secret store.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.