What Happens to Your Uploaded Images on GitHub When You Remove the URL?

Samir Patil
2 min readJun 19, 2024

--

Photo by Roman Synkevych on Unsplash

Have you ever uploaded an image to a GitHub pull request (PR) description or comment box and wondered what happens to it if you remove the URL later?

When we drag and drop images directly into the description, it calls an API to store the images on GitHub’s server and returns a URL. However, if you remove the URL from the description, what will happen? Will the image be deleted from GitHub’s server immediately, or will it remain there forever, or will it be deleted after some time? I don’t know the exact answer, but it’s been 2 months since the URL was removed, and the image is still accessible with that URL.

The lingering presence of these images highlights the need for clarity on GitHub’s image retention policies. Without explicit guidelines or mechanisms for managing uploaded images, users may inadvertently contribute to the accumulation of digital clutter on GitHub’s servers.

If You Are Building Such a Feature in Your Application, What Should You Do?

Firstly, ensure that all images are referenced whenever copied or uploaded. Establish a foreign key relationship between each image and its associated object, such as a comment. Implement a trigger to update images reference accordingly when the associated object is modified. If the image has zero references, then delete the image from the database.

--

--