Glitch to GitLab mirroring private data (.data folder)

Hi everyone, I’m new to Glitch!

I would like to use Glitch to store personal notes. Because this is important information, I want to back up it to GitLab (mirroring).

I wonder if it is possible to add the .data directory to the Glitch repository? I tried both the .gitignore file and a pre-commit / post-commit hack (https://stackoverflow.com/a/12802592), both work as long as I manually committed it in the terminal, but as soon as the auto commit was done, the .data directory was deleted from the repository.

How can I get non-public information into GitLab?

Welcome to Glitch, @bimlas!

By repository, you mean the Glitch project, don’t you?

And .data files are not deleted, they are just hidden in the project. To view all the files and folders in your Glitch project, in the Glitch Console, type ls. To see all the files in the .data directory, in the console, type cd .data, then type ls -a to all the files that it contains.

Currently, in Glitch, all folders starting with ‘.’ are hidden and the only way to view them would be as described above.

And in case you’re wondering, Glitch has a built in console, which you can access by clicking on ‘Logs’ found on the bottom left of the project editor and then clicking ‘Console’. And this is where you need to do all that I’ve said above.

Hope that helps!

@khalby786,

Thanks for the answer, but I think we don’t understand each other:

I know that the .data directory will not be deleted, I can see its contents. My problem is that it does not keep its content in any commit.

Each Glitch project is also a Git repository, I can see the Git log in the Glitch terminal. My problem is that there is no .data directory anywhere in this log and I can’t get Git to follow it:

For example, typing !.data/** in .gitignore allows me to include the .data directory in the repository and I can commit this change manually from the terminal, .data will appear in the commit, but when an automatic commit is done, this directory is deleted from the Git repository: the files are still in the .data directory of the Glitch project, but are no longer in its Git log.

Is it possible to track the .data directory with Git?

Hi Bimlas!

Glitch combines the user’s local .gitignore with a global .gitignore that attempts to prevent users from accidentally committing secrets, including specifically “.data”. It is quite difficult to avoid being a “footgun” - power users like you are comfortable reading and writing the negated globbing syntax of “.gitignore” and want to specify precisely what should happen, but Glitch also tries to support novice programmers who might add or subtract a single “!” or “/” character on the wrong line of their .gitignore, even temporarily, and we don’t want to leak their secrets due to their mistake.

Your use case of “I want this data to both be secret in some ways but also shared with GitLab in some other ways” is unusual; we don’t support that use case well, and we might not for some time.

Please consider these approximations as workarounds:

  1. put your secret data in a directory or file other than “.data” and also not mentioned in “.gitignore”. This secret data will be logged in your Glitch projects’ git repo, and so can be synced to GitLab. It will be visible to the public via your Glitch project’s git repo if your Glitch project is public, and it will be present in remixes of your Glitch repo.
  2. put your secret data in a database-as-a-service, such as Google’s Firestore, RedisLab’s Essentials, MongoDB’s Atlas, IBM’s Cloudant, Amazon’s S3 or many other APIs, or (depending on precisely what kind of data you’re storing and what kind of database admin interface you want, a spreadsheet-as-a-service such as Airtable or Google Sheets) and keeping the secrets to access the data in .env. This allows your project to be public so that people can read your code, and remixable, though remixers will have to set up their own databases. This will not sync your data to GitLab, though.

Hope this helps,

Johnicholas

2 Likes

@Johnicholas,

Thanks for the detailed explanation, the reasoning is understandable, thank you for the ideas.

I want this data to both be secret in some ways but also shared with GitLab in some other ways

In Glitch, the .data directory is private, since its contents are not visible to visitors, the GitLab repository is also private, so notes are also private.

I have another idea, which may not work, but it’s worth a try: in the pre-commit hook, I copy the .data directory to a public directory, and in the post-commit hook, I delete this copy.

Anyway, thank you for your help and your satisfactory response!