caddy-git
caddy-git copied to clipboard
Repo not cloned if directory already exists
Describe the issue
I noticed that if I already have the folder created (/var/www/aspecthq.com), then the repo would not get initialized. I have to run the initial git clone myself. Not a huge deal. I would expect it to work though.
Configuration
Paste full Caddyfile below:
{
git {
repo aspecthq.com {
base_dir /var/www
url https://gitlab.com/joeworkman/aspecthq.com.git
branch master
depth 1
# auth ssh /var/www/ssh/id_rsa.pub
webhook name X-Gitlab-Token go-caddy-git-go
# post pull exec {
# name Pager
# command /usr/local/bin/pager
# args "pulled authp.github.io repo"
# }
}
}
}
aspecthq.com {
redir https://www.aspecthq.com{uri}
}
www.aspecthq.com {
log {
output file /var/log/caddy/aspecthq.com/access.log {
roll_size 3MiB
roll_keep 5
roll_keep_for 48h
}
}
handle_errors {
respond "{http.error.status_code} {http.error.status_text}"
# rewrite * /{http.error.status_code}.html
# file_server
}
route /update {
git update repo aspecthq.com
}
encode gzip zstd
php_fastcgi unix//run/php/php8.1-fpm.sock
file_server
root * /var/www/aspecthq.com
push
}
Version Information
Provide output of caddy list-modules -versions | grep git below:
git v1.0.4
http.handlers.git v1.0.4
I noticed that if I already have the folder created (/var/www/aspecthq.com), then the repo would not get initialized.
@joeworkman , yes, because it is unclear what is that directory, i.e. cannot simply remove it.
I have to run the initial git clone myself. Not a huge deal. I would expect it to work though.
Say it discovers a directory (due to misconfiguration). What would be the logic to decide to pull it?
What would you remove it? With the git clone command, do you not have to ability to define where you want the destination for the clone? Via terminal I use...
git clone https://gitlab.com/joeworkman/aspecthq.com.git /var/www/aspecthq.com
@joeworkman , is this still an issue?