Skip to content

Instantly share code, notes, and snippets.

@atlance
Created May 4, 2022 07:57
Show Gist options
  • Save atlance/9a35f52f5cff0feb0c2abaf882e8697c to your computer and use it in GitHub Desktop.
Save atlance/9a35f52f5cff0feb0c2abaf882e8697c to your computer and use it in GitHub Desktop.

Revisions

  1. @jonlong jonlong created this gist Aug 12, 2013.
    22 changes: 22 additions & 0 deletions archive-and-restore-from-github.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    ## Archive a GitHub Repository

    git clone --bare [email protected]:jonlong/<repo>.git
    tar -czf <repo>.git.tar.gz <repo>.git

    ## Deploy an Archived Repository to GitHub

    Create a new private repository on the target account:

    curl -F 'login=<user>' -F 'token=<token>' -F 'name=jonlong/<repo>' -F 'public=0' http://github.com/api/v2/json/repos/create

    Extract the archived repository:

    tar -xvzf <repo>.tar.gz

    Navigate to the bare repository:

    cd <repo>.git

    Push the repository to GitHub

    git push --mirror [email protected]:jonlong/<repo>.git