I am not very familiar with the terminology or practices and procedures of version control.
Here is what I want to do :
I want to download a folder from a git repository from the Internet. Is cloning the right way to do it ? WOn't cloning keep the unnecessary meta-data files ? Is there a way to do a "clean" download ?
I want to set up a local repository that contains this folder on which I can now use version control. That is, when I do a commit, my local repository gets updated.
Finally, I want this local repo to be accessible on the local network, so that I can download it from any other machine on the LAN too.
To clone git repository into a specific folder, you can use -C <path> parameter, e.g. Although it'll still create a whatever folder on top of it, so to clone the content of the repository into current directory, use the following syntax: cd /httpdocs git clone [email protected]:whatever .
When you clone a repository initially to get it onto your computer, you copy the entire repository from a remote location to your local computer. During this processes, git will add a remote to your local copy of the repository called origin . This will point to the location of the repository that you cloned from.
git clone
of Git Reference.If you are not familiar with those operations, I would recommend you to follow the simple exercices proposed by git immersion.
You can't download single files or folders from a git repo, since git tracks the full state of a project as a whole, not just single files. There is a possibility to clone only a limited set of revisions (called shallow clone) from a remote repositoy, but such clones are restricted to a limited set of operations, for example you can't clone from a shallow clone, or push something from such a repo.
If the size of a git repo bothers you, you can git gc
to make git reorganize the object database, which sometimes can get size improvements.
When you want to have a local cache, you can use git clone --mirror $REMOTE_URL
to create a clone, which
You can clone new working repos from this local cache repo, and either push directly into the upstream repo (you need to git remote add upstream $REMOTE_URL
in your working copy to add the link to the upstream repo, afterwards you can git push upstream
), or you can push into the local cache repo, and push to the upstream repo from there.
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