This content originally appeared on Geoff Graham and was authored by Geoff Graham
Don’t laugh. I’m a complete Git noob. I needed to clone a WordPress project locally and repo was just the wp-content
directory of the site.
If I cloned this normally, it would install the entire repo to my machine, including the top-level root directory. But what I needed was just the contents of that directory so that I could use it with a standard WordPress installation.
The trick? Well, two approaches will do. The first is to cd
into a completely empty /wp-content
folder and clone the repo like this:
git clone https://github.com/some/repo.git .
That extra dot at the end. That’s all it takes! But if you find yourself getting an Terminal error that the directory isn’t empty, make sure you check for hidden files, like the classic ol’ DS_Store
.
If that approach won’t do, it just takes a couple more steps:
git init
git remote add origin https://github.com/some/repo.git
git pull origin master
Either of those approaches will clone just the contents of the repo rather than packaging them up into a root directory.
The post How to clone just the contents of a GitHub repository appeared first on Geoff Graham.
This content originally appeared on Geoff Graham and was authored by Geoff Graham

Geoff Graham | Sciencx (2020-08-26T00:44:37+00:00) How to clone just the contents of a GitHub repository. Retrieved from https://www.scien.cx/2020/08/26/how-to-clone-just-the-contents-of-a-github-repository/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.