I have already Caddy configured with git plugin. Now I have made a seprate and new repository which I want to deploy on my web page. This new repository is made with create-react-app and react, and the one I am already hosting is made with plain JS if that matter.
I have tried to just do git clone, but I get a warning and suggestion about using submodules. I tried submodule, but I dont think that is the right solution.
Hi @andymoose, can you elaborate on what you’ve tried? Specific commands you’ve used, error messages you’ve received, and your current Caddyfile will help us understand what’s happening.
It doesn’t look like you have added a submodule at all. It looks like you’ve just moved another repo inside the first repo and tried to add it, which doesn’t work when other people (read: Caddy servers) try to pull the main repo. The message you get when you git add . explains this.
I assume the embedded repo is meant to be available at the /reactrepo path? I can’t see any other folder in the repo that looks like it might be called /reactrepo, but you have blanked some out.
You need to actually add the second repo as a submodule to the main repo. The warning/hint message explains how to do that.
Then, because git cloning doesn’t automatically initialise and clone submodules, you need to add a flag to the git command that Caddy uses to grab the files.
The Caddy git directive lets you specify additional flags for cloning and pulling - the clone_args and pull_args subdirectives. The flag you want is --recurse-submodules.
In your Caddyfile. You need Caddy itself to recurse the submodules when it pulls the main repo, so it gets everything. Otherwise it’ll only get the main repo, regardless of the submodule.
Well, that’s going to make things difficult, because when Caddy pulls the repo, it does it anonymously. You’ll need to add an SSH key and specify it in the git directive, too, so that Caddy can authenticate to Github and pull the private repo.
And I made it public again so I dont have to add any more in my Git directive. If I wanted, where do I find my sshkey lol? I know I have made one before, but it is a long time ago.
webPage.com does work is that is what you meant with “does the webroot index work”
I dont know how to check if blank directory is present under the webroot, how do I check it? Since I get a 404, could it be that I miss it some how in the index file?
You’ll need to browse to the actual location of the files on disk after Caddy’s pulled the repo - like, with a file explorer or in a terminal - and look at them.