Constant Full Storage from .git

I constantly get my disk filled up from the .git folder and run rm -rf .git to clear it. How do I clear it automatically or somewhere in my code?

git.sh

rm -rf .git

Install package node-cmd

If you have an express server make this route:

const cmd = require('node-cmd');

app.get('/clear-git', (req, res) => {
	cmd.run('chmod 777 git.sh'); /* Fix no perms after updating */
	cmd.get('./git.sh', (err, data) => {  // Run the script
		if (data) console.log(data);
		if (err) console.log(err);
	});
	
	cmd.run('refresh');  // Refresh project
	console.log('Project clear');

	return res.status(200); // Send back OK status
});

Then add the http://project-name.glitch.me/clear-git to your UptimeRobot dashboard every X minutes/hours you want to run this command.

hey @efewqefwfd if you’d like to address the problem at the source instead of working around it by deleting your project’s history, you’ll need to find what files are being changed often and are filling up your repo and add them to a gitignore file. This post talks about the basics.

Once your git repo is ignoring files that change often it should stop filling up your disk space.

The file that keeps changing is a json file, if I add .gitignore will it still work the same?

Yes, but it will be hidden from the editor. You can still do cat <file>.json from the Console

.gitignored files will also be missing from Rewind (although Glitch’s project backups will still include it).