I have a Git repository in a directory served by apache on a server. I have configured WebDAV and it seems to be running correctly. Litmus returns 100% success.
I ca
En example of write authentified git dav virtualhost with gitweb enable that could solve your problem :
ServerAdmin admin@example.com
ServerName git.example.com
DocumentRoot /var/git
# SSL configuration
SSLEngine on
# Fix dav header
#RequestHeader edit Destination ^https: http: early
DAV on
Options ExecCgi FollowSymLinks
# Gitweb config
AddHandler cgi-script .cgi
DirectoryIndex .gitweb.cgi
SetEnv GITWEB_CONFIG /var/git/.gitweb.conf
# Basic auth config
AuthType Basic
# Auth title
AuthName "Git repositories"
# Use file and external providers
AuthBasicProvider file
# File location
AuthUserFile /var/git/.htpasswd
Require method GET OPTIONS PROPFIND
Require valid-user
Then just clone your repository with your user :
git clone https://user@git.example.com/repository
And when you will try to push it will ask your password and provide it.
Placing the password in the clone url is a security bad practice as anyone can read it in your .git/config.