Import Project from sub-folder within git repository

Hello!

I’m wondering if it’d be possible to import a project from a sub-folder within a repository?
like, I have this blog series repo here: https://github.com/NullVoxPopuli/react-vs-ember/tree/master/testing/ember

that particular one is structured like: {blog-topic}{ui-tool/framework}. So far, I have 6 project in that repo that need a home :slight_smile:

Thanks!

You can’t do this directly with the git import feature, but you have access to git in the console inside your project, so you can do it from there with normal git commands.

Could someone post an example of how to do this?

I’ve opened up the console in my glitch project (ctrl+shift+x) and tried “git pull url_to_subfolder” and “git clone url_to_subfolder” neither of which work. They produce a “fatal: repository not found” error. This is the way I would download from github to my computer using normal git commands, but I’m no expert in git.

Does one need to use the sparse checkout command? https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository

This thread also implies it’s not possible to export / push changes on glitch back to github.

Are you running those commands shortly after creating the Glitch project? Git isn’t available straight away, it auto-commits after 15 minutes or so and is available after the first one.

See this detailed response for using git and Glitch together, along with a link to some example commands: Code locally, push to glitch via git?

1 Like

Thanks Gareth. I’ve logged back in today and glitch did indeed pull from my git hub subdirectory. I assumed the changes were instant, similar to using the “import from glitch” button.

To clarify, it’s just the creation of the git repo which is slightly delayed after creating a new project. Once in place, everything else happens instantly as you’d expect - so importing via a git command happens straight away.