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)
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.
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 :
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.
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…
Ok Adam , 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
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 ).