Sage Files Cloned from Github ignored by Git

Hi,

I cloned the Sage repository in a directory.

Unfortunately git is ignoring this folder so I can’t commit and deploy the theme files.

Should I remove the git folder or do something to add it in my repository ?

I’ve spent hours on this and am stuck :open_mouth:

Thank you !

I finally found this : http://stackoverflow.com/questions/14620863/git-add-all-subdirectories

It works partially, still searching.

If you cloned Sage you’ll need to delete the .git folder from the Sage directory. Sage is meant as a starter theme, so the intent is to clone it from source and then commit it, and all the changes you make to it, to your own repo.

EDIT: if you’ve already deleted the Sage .git folder, you could see if you need to git add the new Sage folder to your project repo.

2 Likes

Not really sure what the exact issue you’re having but anything listed in .gitignore will be ignored by git, if you want a file/directory that’s listed there to be committed to git, just remove it from there.

Thank you. I did it and git add . again. For now it’s not working.

The gitignore contains the proper directories :

dist
bower_components
node_modules
npm-debug.log
vendor

I will update if I find a solution.

Are you using Bedrock? If so, then doing what MWDelaney said should work. If you’re just using git with your theme, just update the remote url to point at your repo, you may need to run git init before git add .

I’m actually very curious about why dist is in gitignore. Not sure why but for some reason on my last deploy none of the images/fonts etc in my Sage theme appeared on the live site. So I removed it from the file, redeployed and obviously it’s there now. But the roots example project has the folder ignored so perhaps something else is wrong.

This is the default for Sage because it wants to encourage you to deploy your compiled assets and only commit your source files to Git.

It makes sense but it took me some time to wrap my head around and I removed dist from .gitignore on all of my projects for about a year before I transitioned to using Trellis and deploy hooks to transfer my compiled assets to the remote server.

There’s nothing wrong with committing dist it just isn’t the strictest platonic ideal “right way” and one of Sage’s big things is nudging you towards that platonic ideal.

2 Likes

Hmm … that’s nice in theory, but if dist doesn’t make it to the live server the theme breaks :confused:

Trellis is creating / updating the dist directory on the server every time I deploy thanks to their hook.

But all the other files are not going to the repo :cry:

Yes !

Maybe I removed too much or not enough ?

I just tried and I still can’t see the themes files in sourcetree :frowning:

If it isn’t picking it up, then git is initialized in some directory in your bedrock install in order to be causing the repo to not pickup those folders. I’ve ran into this before myself.

Thanks. What could solve this ?

Cheers

This is really more of an issue with familiarity with Git than it is with Roots or Sage.

From the above it seems to many of us that you have an extra .git directory hanging out somewhere in your file structure which is causing the “parent” git repository to treat the subdirectory that .git directory is in as a submodule.

At this point we might have exhausted the abilities of a free support forum, especially since the problem is not with the software this forum supports.

Ok, Thank you for the follow up.

Go through all the folders in Bedrock (if you arent using Bedrock, then it is somewhere in your site folders), because you have an extra .git folder that you probably initialized when you were using the CLI. Save your theme an nuke your Bedrock install and start at square one is what I would suggest. Good luck man, you’ll “Git” it.

1 Like

Inspired by your suggestion, I moved the whole “site” directory on my desktop, committed, then moved it back in my website directory and committed again !

Aside : I noticed that the Sage readme on github suggests to create a Composer project instead of cloning the git repo. Not sure if it would impact that kind of “issues”.

Thanks again,

Phil

Just wanted to add my 2 cents here. The easiest way to get Git setup exactly the way that you want/need is to is follow these simple steps:

rm -rf .git - Delete the .git folder in your theme root.
git init - Reinitialize git in theme root
Add/update .gitignore with any files that you don’t want git to track
git add . Stages all files (excluding those in .gitignore) to commit
git commit -m "Initial commit" - Commit all tracked files.

That’s it…you’re all set.

1 Like