{"id":16842642,"url":"https://github.com/rofl0r/git-recreate","last_synced_at":"2025-03-18T05:42:17.399Z","repository":{"id":138311330,"uuid":"62802855","full_name":"rofl0r/git-recreate","owner":"rofl0r","description":"recreate entire git repository from a copy of .git contents","archived":false,"fork":false,"pushed_at":"2018-08-01T04:35:04.000Z","size":2,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T12:25:53.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-07-07T11:48:56.000Z","updated_at":"2024-11-01T16:53:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ace2c74-a2f8-45a9-9c8e-3f425f83e8f7","html_url":"https://github.com/rofl0r/git-recreate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fgit-recreate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fgit-recreate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fgit-recreate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fgit-recreate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/git-recreate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244166638,"owners_count":20409177,"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":[],"created_at":"2024-10-13T12:47:33.878Z","updated_at":"2025-03-18T05:42:17.367Z","avatar_url":"https://github.com/rofl0r.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to recreate a complete git repository from the .git directory\n\n## Why ?\n\nif you have a git clone of a repo, you basically have the entire history\nin the .git directory, plus a copy of the most recent file version of each\nfile.\nin the worst case this means twice the disk space usage.\n\nfor archiving purposes it thus makes sense to store only the contents of .git\nand leave the rest away, as it can later be recreated.\n\nthere's also the problem that huge git repos are nearly impossible to clone\nwith a slow internet connection, since there's no way to resume the download\nonce it fails (say you've downloaded 99% of a 2GB repo, and your connection goes\noff - you have to download the whole 2 GB again).\nin that case the most effective method to transfer the repo to your box is the\nfollowing:\n\n- ssh into some dedicated server that has a good bandwith.\n- clone the git repo there. the process probably just takes a few seconds,\n  since most dedicated servers are behind GBit connections.\n- cd into the clone and do `tar cf myproject.tar .git/`.\n  it makes no sense to waste time using compression since the contents of\n  .git are already compressed.\n- put myproject.tar in some directory thats available via http.\n- download the file via `wget -c myhost.com/myproject.tar`.\n  wget can (and with `-c`, will) automatically resume the download when your\n  connection goes away.\n\n## How ?\n\nOnce you have the bare .git contents put into an empty directory whose name\ndescribes the original projects name, and cd into it, git thinks that you\ndeleted all the checked out files.\nso the only thing you have to do is to undo your changes:\n\n- `git stash` followed by `git stash drop` and voila - the entire git repo\n  is now as if freshly cloned with all files checked out.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fgit-recreate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Fgit-recreate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fgit-recreate/lists"}