{"id":26220964,"url":"https://github.com/budavariam/migrate-hg-to-git","last_synced_at":"2026-04-14T04:31:23.726Z","repository":{"id":91220357,"uuid":"230762070","full_name":"budavariam/migrate-hg-to-git","owner":"budavariam","description":"Migrate bitbucket mercurial to git","archived":false,"fork":false,"pushed_at":"2019-12-29T14:47:47.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T11:45:02.368Z","etag":null,"topics":["bash","bitbucket","fast-export","git","hg","jq","mac","mercurial","migration","python2"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/budavariam.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}},"created_at":"2019-12-29T14:33:36.000Z","updated_at":"2021-02-06T13:20:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"c965d1bc-69fb-42d6-a37a-746c99fbfad4","html_url":"https://github.com/budavariam/migrate-hg-to-git","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/budavariam/migrate-hg-to-git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budavariam%2Fmigrate-hg-to-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budavariam%2Fmigrate-hg-to-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budavariam%2Fmigrate-hg-to-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budavariam%2Fmigrate-hg-to-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/budavariam","download_url":"https://codeload.github.com/budavariam/migrate-hg-to-git/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/budavariam%2Fmigrate-hg-to-git/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31782736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bash","bitbucket","fast-export","git","hg","jq","mac","mercurial","migration","python2"],"created_at":"2025-03-12T15:28:57.376Z","updated_at":"2026-04-14T04:31:23.714Z","avatar_url":"https://github.com/budavariam.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migrate mercurial to git\n\nBitbucket stops supporting mercurial repositories in 2020.\n\nMy first version control was Mercurial, so I had a bunch of repositories, and bitbucket was my main repository holder while I learned to code.\nI decided to save the files stored in those repositories, but I did not want to do all that by hand, and until this day there is no one/click solution to migrate those repositories.\n\nI Used `OSX` 10.15.2, `bash`, `jq`, and `fast-export` for this task.\n\n## Prepare\n\nI did not script these steps:\n\n* `brew install mercurial, jq`\n* Add my public ssh key to bitbucket\n* Get a json of my mercurial repositories. Into `repos/repos.json`. (bitbucket api or [network inspector](https://bitbucket.org/!api/internal/dashboard/repositories?pagelen=25\u0026page=1\u0026q=scm%20%3D%20%22hg%22)).\n* create new repositories with some name prefix e.g: `g_` (bitbucket api or by hand)\n\n## How the script works\n\nIt is based on the [git documentation](https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git#_mercurial) about migration.\n\n1. Clone fast-export\n1. Parse the provided `repos/repo.json` file\n1. Clone the hg repositories into `repos`\n1. Prepare the **PYTHON2** environment that is necessary for fast-export\n1. Create a `newrepos` folder, and init git repositories over there.\n1. Migrate repos to the new location\n1. Add new git origin, push\n\n## Run\n\n```bash\n./script.sh BITBUCKET_USERNAME\n```\n\nThis script does not delete anything, and works only in this folder hierarchy, but I advise you to review it without starting it.\nI might have missed something that is necessary for different repositories, I am happy with my result.\n\n### Troubleshooting\n\n#### Illegal byte sequence error\n\nOne of my repositories contained a binary file with accented characters in its name from windows.\nHG would not clone these for me with this error: `abort: Illegal byte sequence`.\n\nI checked that repo out in windows, renamed the file and committed a change with the new name.\nIt fixed my problem.\n\n## IMPROVEMENT IDEAS\n\n* script bitbucket api for getting and creating repositories\n* keep the projects instead of adding everything to the user, would need to parse url, or get that info with jq\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbudavariam%2Fmigrate-hg-to-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbudavariam%2Fmigrate-hg-to-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbudavariam%2Fmigrate-hg-to-git/lists"}