-
To stop codespaces we just need to navigate to the Codespaces option in the bottom left of the Codespace panel.
-
After clicking on codespaces option we will get a drop down above something like this👇
-
Click on "Stop Current Codespace". It will stop the codespaces you are currently using or running.
-
You will be redirected to a Restart Codespaces page. The page shows a link to restart the codespace you just stopped.
If you do not interact with the codespace, it will close automatically when it reaches the idle timeout limit. By default, this is 30 minutes, but you can set a personal timeout limit in your GitHub settings.
The code changes and operations we have performed inside the codespace will still be inside the stopped codespace. If your codespace is stopped then you can restart it as shown below.
- Go to github.com/codespaces
- Here we can see a list of the codespaces we have created
- To restart it, we can just click on the codespaces we wanted to use and it will start the codespaces again for us.
- You can also see an active label added to the codespaces we just started
Access Settings:
- Click your profile photo in the upper-right corner of any GitHub page.
- Click "Settings."
Navigate to Codespaces Settings:
- In the sidebar, under "Code, planning, and automation," click "Codespaces."
Set Retention Period:
- Under "Default retention period," enter the number of days (between 0 and 30) for which you want your codespaces to be retained after they have been stopped. Example: Setting it to 30 days.
Warning:
- Setting the retention period to 0 days will result in immediate deletion of codespaces when stopped or when they timeout due to inactivity. For more details, refer to "Setting your timeout period for GitHub Codespaces."
Save Changes:
- Click "Save" to apply the new retention period.
This allows you to customize how long your codespaces are kept before automatic deletion, balancing convenience and storage management.
Auto Delete Codespace:
- Go to the "Your codespaces" page at github.com/codespaces.
- Find the codespace you want to exempt from deletion.
- Click the options menu (three dots) to the right of the codespace.
- Select "Auto Delete Codespace" from the dropdown menu. The bookmarked codespaces will not be auto-deleted.