I'd like to export from github remote repository, not cloning it. Similar to svn export, I do not want to get .git folder with it. I can work around it by cloning and removing .git folder. I wonder if there is a cleaner way?
I read it somewhere you can use git archive to achieve this.
However I got the following errors..
$ git archive --format=tar [email protected]:xxx/yyy.git master | tar -xf - Invalid command: 'git-upload-archive 'xxx/yyy.git'' You appear to be using ssh to clone a git:// URL. Make sure your core.gitProxy config option and the GIT_PROXY_COMMAND environment variable are NOT set. fatal: The remote end hung up unexpectedly
Any help would be great. Thanks.
Visit your account settings page. Click “Start export” in the “Export account data” section. You will receive an email when the export is ready. Click the link in the email to download the archive.
Thanks to the Subversion support by GitHub, you can use svn export
to get the project without any version control files:
svn export https://github.com/user/project/trunk
Notice the URL format:
https://github.com/
USERNAME/PROJECTNAME
without .git
/trunk
appended at the endThis way you can get branches and subdirectories too.
This creates a directory with the exported files. It's not possible to create a tar/zip directly, you have to do in two steps (export + zip). This is a limitation of svn export
itself.
As @Jon pointed out, this will create the export in a directory named trunk
by default. You can specify a different name if you prefer:
svn export https://github.com/username/projectname/trunk projectname
You can use this technique to export any sub-directory of the project. For example if you want only some/path
, you can do:
svn export https://github.com/username/projectname/trunk/some/path local-dir-name
You can get paths from branches and tags too. The endpoint https://github.com/username/projectname
behaves fully as a Subversion repository with a regular layout, so you will find branches in https://github.com/username/projectname/branches
and tags in https://github.com/username/projectname/tags
.
Before you export something large by mistake, it's good to check first the content of the path. You can do that using svn ls
, for example:
svn ls https://github.com/username/projectname/
Normally this should give you:
branches/ tags/ trunk/
You could iteratively explore the repository this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With