Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I email someone a git repository?

Tags:

git

I have tried:

git archive HEAD --format=zip > archive.zip 

:and then I email archive.zip and at the other end they unzip archive.zip into a folder. But when they try any git commands they find out that this does not produce a valid git repository

like image 478
yazz.com Avatar asked Mar 30 '10 14:03

yazz.com


People also ask

How do I send a git repository?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", click Transfer. Read the information about transferring a repository, then type the name of the user or organization you'd like to transfer ownership of the repository to.

How do I share a GitHub repository by email?

In the search field, start typing the name of person you want to invite, then click a name in the list of matches. Click Add NAME to REPOSITORY. The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.


2 Answers

You could use git bundle and email one single file

See "backing up project which uses git"

A git bundle is just one file which can be very easily created and again imported as it can be treated like another remote.

Once received, you can clone it or fetch from that file.

As mentioned in "Backup of github repo", you will probably want for the first email to make your bundle with all branches:

$ git bundle create /tmp/foo-all --all 

As Andreas mentions in the comments, Scott Chacon recently (March 2010) wrote a "cute" article on this topic in the ProGit blog:

Git's Little Bundle of Joy

like image 53
VonC Avatar answered Sep 27 '22 15:09

VonC


As previous answer said, git bundle is the way.

If you want to create a bundle from using only one branch (I prefer bundling only main) and sending over e-mail, you can do something as below:

git bundle create ~/mygitbackup.bundle main 

Above will create a git bundle file in your home directory.

like image 44
Manu Manjunath Avatar answered Sep 27 '22 15:09

Manu Manjunath