{"id":28565395,"url":"https://github.com/nongvantinh/bitbucket-delete-git-lfs","last_synced_at":"2025-06-10T14:15:28.681Z","repository":{"id":295618529,"uuid":"990653931","full_name":"nongvantinh/bitbucket-delete-git-lfs","owner":"nongvantinh","description":"This Python script helps you delete Git LFS files from your Bitbucket repository by mimicking browser behavior using session cookies","archived":false,"fork":false,"pushed_at":"2025-05-26T13:44:28.000Z","size":203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"development","last_synced_at":"2025-05-26T14:22:24.068Z","etag":null,"topics":["delete-git-lfs","git-lfs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nongvantinh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-26T12:38:22.000Z","updated_at":"2025-05-26T13:44:31.000Z","dependencies_parsed_at":"2025-05-26T16:47:25.684Z","dependency_job_id":null,"html_url":"https://github.com/nongvantinh/bitbucket-delete-git-lfs","commit_stats":null,"previous_names":["nongvantinh/bitbucket-delete-git-lfs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nongvantinh%2Fbitbucket-delete-git-lfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nongvantinh%2Fbitbucket-delete-git-lfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nongvantinh%2Fbitbucket-delete-git-lfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nongvantinh%2Fbitbucket-delete-git-lfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nongvantinh","download_url":"https://codeload.github.com/nongvantinh/bitbucket-delete-git-lfs/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nongvantinh%2Fbitbucket-delete-git-lfs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259090425,"owners_count":22803678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delete-git-lfs","git-lfs"],"created_at":"2025-06-10T14:15:28.071Z","updated_at":"2025-06-10T14:15:28.661Z","avatar_url":"https://github.com/nongvantinh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitbucket LFS Cleanup Script\n\nThis Python script helps you delete Git LFS files from your Bitbucket repository by mimicking browser behavior using session cookies. It is intended for **personal/admin use only** and is **not affiliated with Atlassian or Bitbucket**.\n\n### Usage\nThe script provides three options: `--fetch`, `--locate`, and `--delete`.\n\n`--fetch`: Retrieves all the OIDs of the Git LFS objects in the repository and saves them to the file `git-lfs-data.txt`.\n\n`--locate`: Reads all the OIDs from the `git-lfs-data.txt` file and checks against the Git log to determine if any commits still reference them. If none are found, it outputs the information of the Git LFS objects to the file `dangling-git-lfs-data.txt`.\n\n`--delete`: Reads all the OIDs from the `dangling-git-lfs-data.txt` file and performs the delete operation.\n\n### Instructions for Using the Script\n\nBefore doing the steps below, remember to install the required dependencies: `pip install -r requirements.txt`\n\n1. Navigate to **Repository Settings** and select **Git LFS**.\n2. Open the Chrome browser and press `F12` to access the Developer Tools. Navigate to the **Network** tab and search for the following URL:  \n   `admin/lfs/file-management`\n3. In the **Cookies** tab, copy all the cookies and update the `cookies` map in the `config.py` file with the copied values.  \n   ![Get Cookies](get-cookies.png)\n4. Perform the cleanup process by executing the following command:  \n   ```bash\n   python git-lfs-bitbucket.py --fetch --locate --delete\n   ```\n\n\u003e **Note:** This is a destructive process. Once files are deleted from Bitbucket Cloud, they are permanently removed. While it is uncertain if the files are completely erased from Bitbucket's backend, this action is irreversible. Proceed with caution.\n\n## Disclaimer\n\n**USE AT YOUR OWN RISK.**\n\nThis script:\n- Requires you to be logged into Bitbucket in your browser.\n- Requires you to manually provide your session cookies.\n- Is not an official API client and may stop working if Bitbucket changes their website.\n\nThe author is not responsible for any misuse or account issues. Always comply with Bitbucket's Terms of Service.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnongvantinh%2Fbitbucket-delete-git-lfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnongvantinh%2Fbitbucket-delete-git-lfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnongvantinh%2Fbitbucket-delete-git-lfs/lists"}