I was editing a theme I had downloaded and was using Git to track changes. Normally, it is quite easy to use Git and a remote repository to duplicate development across machines, but without checking in the entire ghost installation into the repository I had extreme difficulties getting cross-machine development.
In the end, I have found a solution that works and wanted to share it with anyone that might be having the same issues. The basic gist of it is that for each development machine you use the ghost-cli to install a fresh local ghost installation, and using .gitignore only track the files within your theme folder.
So, to develop on a new machine you would:
- Create a new folder
- Use the ghost-cli to install a new local ghost
- Init .git
- Add your remote repository
- Pull in your changes
- Start ghost
Here is the .gitignore file I’ve used to allow this:
/* !content/ content/* !content/themes/ !content/themes/* !content/themes/**/* !.gitignore .DS_Store node_modules bower_components content/themes/casper content/themes/**/assets/built
Note if you’ve already been using git with a theme and have checked in files related to the ghost installation that is giving you an error when you try to pull the repository to a separate machine… you may need to just rip out the theme folder into a fresh Ghost Installation with that .gitignore file in place. For my own project I was unable to retroactively fix the Ghost installation, even with
git rm --cached everything in the repository except the theme folder.