I tried to reduce the disk usage on one of my projects [SOLVED]


#1

I tried to reduce the disk usage on one of my projects that was over quota but it is still suspended and I can’t access the console or editor on that project to try to fix it


#2

Hey @BarnMS can you let us know which project and we can take a look? If you want to keep your project private you can also email it to support@glitch.com.


#3

The project URL is crown.glitch.me

The project code is private, do I have to make it public?


#4

I’ve gone ahead and temporarily lifted the size limit on your project for 24 hours to give you the opportunity to get it back in line.

It’s likely that your .git directory is the cause of your problems. Make sure to place any files that change often either in your .gitignore file or in the .data folder - regular changes to files tracked by git will cause your repo to consume too much space. Once you’ve handled that you can run git prune followed by git gc to clean up the extra space.


#5

Whilst running git gc i recieved the error message:

error: cannot lock ref 'refs/heads/master': Unable to create '/app/.git/refs/heads/master.lock': File exists.

Edit: I have also removed all the large files used and it is still over quota despite only containing a few small files

Edit 2: it is still at 228mb


#6

Do you get the same error if you try it again?

Glitch automatically commits any changes in your repo every 5 minutes (which is what powers the rewind functionality) and that error sometimes indicates that there are two git commands executing simultaneously. Perhaps you git gcd while a git commit was running.


#7

I have tried again and the full console response is

app@crown:~ 21:03 
$ git prune
app@crown:~ 21:03 
$ git gc
error: cannot lock ref 'refs/heads/master': Unable to create '/app/.git/refs/heads/master.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
error: cannot lock ref 'HEAD': Unable to create '/app/.git/refs/heads/master.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
error: cannot lock ref 'refs/heads/master': Unable to create '/app/.git/refs/heads/master.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
error: failed to run reflog

#8

Ok, I think you have two options.

  1. If you don’t care overmuch about the history of your project and don’t need to rewind you can just delete the .git directory and it will be created afresh the next time Glitch needs it
  2. Get to a point where you’re not making changes to any files tracked by git (one way to tell this is to run git status in the console, and if it tells you there’s nothing to commit you’re in good shape - for now). Once there delete the offending master.lock and try your git gc again.

Let me know how you get on.


#9

Now that I have removed .git it says that I am using 1mb of disk usage, thank you


#10

@BarnMS Already tried enable-pnpm in the console??? Might work :wink:

~Rienknr1


#11

Because the procect was made after pnpm was added to glitch it should already be on. The problem was with .git taking up too much space as it was being made larger every time any of my database files were updated.