I am very new to Git, but spent far too much time trying to achieve this. We had a contractor to do it for us a year ago for us, so unless i am missing something, this is doable.
We have a git repository (only the project.git and .git directories) this project is a custom website. So we need to extract all the files from the repository to be able to deploy the site.
I can see a lot of objects, but obviously nothing which i was expecting (.aspx files etc...)
So what is the process to get the files out of the repository?
Let me know if I haven't been clear
There is no "git export" command, so instead you use the "git archive" command. By default, "git archive" produces its output in a tar format, so all you have to do is pipe that output into gzip or bzip2 or other.
In your test repository try creating an additional file at the top level. If you follow your instructions, then you'll also get a copy of that file as well as the directory you want. Remove the 'git sparse-checkout init --cone' but follow all your other instructions, and you'll just get the directory tree you want.
Your contractor left you a bare repository. It is used by Git for remotes that don't have a working copy (for example, on a server).
Just clone from the bare repository:
git clone project.git
You should end up with a directory called project
that has a checkout of the master
branch and a .git
directory with a clone of the repo. This project
directory is a full copy of the repo, but it's the kind you can do useful things with.
The terminology git
uses for this is clone and it means to make a copy of the repository in the current directory.
For example:
git clone https://github.com/path/to/project
Optionally you can specify a target directory and put your project there like so
git clone https://github.com/path/to/project path/to/directory
From Git's documentation.
Assuming you just want to get all the files out of the repository without creating a new one by cloning, you could just use git archive
. See this question or the documentation on how to use it.
If you need something other than the master
branch, you can get a list by using git branch
(documentation here).
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