Storing Ghost site in Git repo from Windows

I cannot for the life of me get the symlinks used in Ghost to add to my git repository. I need help, because the last time I tried to bring the repo down without those symlinks (current and casper) the entire ghost install broke down and I couldn’t repair it. I have data in this install that I would like not to lose.

My setup is as follows

  • Ghost local install on windows desktop
    • run ghost start and work on website
    • run static-ghost from this NPM repo to produce a static site in /public
  • push repository to gitlab
    • CI/CD publishes /public to gitlab pages
    • subdomain pointed at gitlab pages

This all works so far.

The problem is that my repo is incomplete, and I cannot download the repository and rebuild the project correctly, because the two symlinks are not pushed to the repository. The exact errors are given below. I have the same setup for two projects, and it worked fine for building one, while the other seemed to lose the symlink and became unusable. That’s when I realized that they were symlinks and that they weren’t being added to the repository, so I couldn’t clone down a working version of the repo.

Environment deets

  • OS
    • windows 10 home, 1903
  • What’s your URL? This is the easiest way for others to debug your issue
  • What version of Ghost are you using?
    • ghost-cli: 1.13.1
    • ghost 3.15.3
    • git
  • What configuration?
    • ghost install local
  • What browser?
    • chrome
  • What errors or information do you see in the console?
$ git add .
warning: could not open directory 'content/themes/casper/': No such file or directory
warning: could not open directory 'current/': No such file or directory
  • What steps could someone else take to reproduce the issue you’re having?
    • be on Windows 10
    • be sure git bash is installed with symlinks enabled
    • ghost install local
    • git init
    • open .git/config and be sure that core.symlinks=true
    • git add .
    • observer warning in log, it should be at the beginning and you might miss it.
    • commit and push, then git add . again to observe warning again.
  • what shell are you using?
    • Tried in cmd, powershell, and git bash (with and without admin privelages), none have made a difference.

Further details

I understand that symlinks are not well supported in windows. I’ve enabled them in the git config for the project, but that hasn’t helped. .git/config core section follows:

	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = true

All the advice I’ve seen on stackoverflow and everything else talks about creating symlinks on windows. I don’t need to create a symlink, ghost install local does that already. I need to add, commit, and push existing symlinks to my git repo.

My entire .gitignore follows:

# Logs

# Runtime data

# node

# ghost

I untracked node_modules so that the repo would be reasonable; I should in theory be able to run yarn in the version directory to rebuild the modules.

I initially had versions and current in the gitignore, but those have been commented out in this new version of the repo, so there shouldn’t be a problem with them being untracked from past commits.

Preferrably, I’d like some way to push ghost’s symlinks to the repo, but I’m willing to try something like copying the files instead if that’s necessary. No idea how to proceed, I’m don’t know how ghost works inside as this is my first attempt to use it.

I would also be open to installing/running Ghost via NPM if that’s a route that I could take that would make it easier to use on Windows.

I would also consider building Ghost from source, but I don’t know if that’s a good solution; the documentation suggests it’s for theme development and I don’t know if it’ll have the same problem.

I guess Hugo is a better choice in this case then.