Problem with Statamic Git integration and Cleavr

Hi,

I was trying to finalize a Statamic setup and in the pipe, I had to configure the git integration, since Statamic is a flat file CMS, I have the habit to use that way to version my content.
I’m used to it on Laravel Forge servers

The Cleavr build succed, however, when I attempt to get the git utility route in the Statamic backoffice, I get an error “missing .git folder not found on my project folder”.
I tried to ssh to my server with cleavr user, test a git init on the current build folder and it prompt to me this :
“Reinitialized existing Git repository in /home/cleavr/userstories.studio/releases/20201110052208/.git/”
I was thinking that may create a symlink in the current build folder with the .git of my webapp but I get still the error.

My php logs say this :

The provided cwd "fatal: not a git repository (or any of the parent directories): .git/" does not exist. {"userId":"my-secret-user-id","exception":"[object] (Symfony\\Component\\Process\\Exception\\RuntimeException(code: 0): The provided cwd \"fatal: not a git repository (or any of the parent directories): .git/\" does not exist. at /home/cleavr/userstories.studio/releases/20201110052208/vendor/symfony/process/Process.php:336)

Hi @Jerem!

Thanks for the question! That’s a pretty cool feature Statamic has.

Unfortunately, I was going through setting up a Statamic example on my side and then noticed that this is a Pro feature… So, unfortunately I can’t fully test on my side.

However, Cleavr does add the .git directory to the project folder in the current directory as implied with the error message you received saying git will be reinitialized.

I’m guessing Statamic may be looking for the .git folder somewhere besides the project root?

I was able to SSH into my server and perform a git push and was successful.

Thanks Adam to trying this !
Indeed this is a pro feature but you can try it with editing the config file :


You are right I’m able too pushing directly from ssh, Statamic should search the .git folder into the root project…

After dig deeper into this, I think this is a problem with the symlink with the /current folder.
Here is where Statamic search my changes, you can see that he search from is release folder instead /current :

How are construct the current folder from the first hook command ?
Do you clone the repo and then make a copy or is it a symlink ?

Ok I just figured that the current folder is a symlink to the last release folder :

Now I don’t get it why it doesn’t work :slight_smile:

During deployments, Cleavr pulls the repo and adds it into a new release folder and is linked to by latest. latest is used mainly by the Canary feature, which allows you to check the deployment before making it live and switch it to be the current directory. During the activation step, Cleavr points current to the latest release folder.

For the deployment hooks, you’d generally use the {{ releasePath }} variable to CD into what will be the current release folder.

Were you able to get the Git Integration to work?

Thanks for explanation that’s more clear for deployement !
For now I don’t use canary.

Nope, I tried to understand how git and symlink works and debug Statamic core Git Service but nothing work from the control panel (the statamic’s backoffice).
I can however ssh to my folder and git push my last changes… :upside_down_face:

Let me see if enabling the Pro option works for me to test.

It seems odd that it wouldn’t work if it works manually via SSH… :thinking:

1 Like

Enabling Pro allowed me to test… pretty easy!

Anyways, I hate to say it, but it seems to have worked for me… :man_shrugging:

Yes but now if you make any changes (add a new entry for exemple), do you have the list of the last commit/changes to push ?
That’s what I’m missing.

Ok Adam :pleading_face:, forget what I said, I’m really sorry !
I just made it works too, actually I was assuming that all my commit were pushed as the docs says it is enabled by default… But no :slight_smile:


After adding this to my .env it fixed the problem !

Thanks again for trying helping me !

PS : my first error was due to an old reference outside of the current folder (migrating V2 to V3 make me more headhache than just init a new V3 project :smiley: ).

1 Like

Awesome, I’m glad you got it working!