User Tools

Site Tools


Sidebar

software:git:lighttpd

What?

I use a git repo on a webserver for “cloud style exchange” of textfiles: japanese, technology and science articles. Sharing between mobile, tablet pc and pc.

on the server, here with lighttpd

  • configure lighttpd.conf:
alias.url += ( "/git" => "/usr/lib/git-core/git-http-backend" )
$HTTP["scheme"] == "https" {
    url.rewrite-once = ( "^/git$" => "/git/" )
    $HTTP["url"] =~ "^/git/" {
        cgi.assign = ( "" => "" )
        setenv.add-environment = (
            "GIT_HTTP_EXPORT_ALL" => "",
            "GIT_PROJECT_ROOT" => "/opt/git"
        )
        auth.backend = "plain"
        auth.backend.plain.userfile = "/opt/path/git_users"
        auth.require = ( "" => (
                "method" => "digest",
                "realm" => "git",
                "require" => "valid-user"
        ))
    }
}
  • create the user file, switch to hashes instead of cleartext:
echo 'chris:somepass' >/opt/path/git_users
  • initialize the git repo:
git init --bare /opt/git/docs

on the client system, Fedora here

  • as user: ensure that the cert of your webserver is trusted, “/home/chris/fluxcoil.net_201404.cert” is my webservers https cert:
$ certutil -d sql:/home/chris/.pki/nssdb -A -t "P,," -n "fluxcoil.net" \
   -i /home/chris/fluxcoil.net_201404.cert
  • Now client commands to use git:
# initial checkout
[chris@спутник docs]$ git clone http://chris:somepass@fluxcoil.net/git/docs

# lets add files
[chris@спутник docs]$ cd docs
[chris@спутник docs]$ cp ~/kernel_intro_kmoriwaka.pdf .
[chris@спутник docs]$ cp ~/japlinux/japlinux.pdf .
[chris@спутник docs]$ ll
合計 2624
-rw-rw-r--. 1 chris chris 1657938  6月  9 16:51 japlinux.pdf
-rw-rw-r--. 1 chris chris 1025323  6月  9 16:51 kernel_intro_kmoriwaka.pdf
[chris@спутник docs]$ git add .
[chris@спутник docs]$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   japlinux.pdf
        new file:   kernel_intro_kmoriwaka.pdf

[chris@спутник docs]$ git commit -a
[master (root-commit) 54d99c8] dsdfsds
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 japlinux.pdf
 create mode 100644 kernel_intro_kmoriwaka.pdf
[chris@спутник docs]$ 
[chris@спутник docs]$ git branch --unset-upstream

# now lets increase the upload size, here to 500MB
[chris@спутник docs]$ git config http.postBuffer 524288000
[chris@спутник docs]$ 

# ..and push a commit:
[chris@спутник docs]$ git push https://chris:somepass@fluxcoil.net/git/docs master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.37 MiB | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://chris:jfdoifdsjfdoijfdoid@fluxcoil.net/git/docs
 * [new branch]      master -> master
[chris@спутник docs]$ 
software/git/lighttpd.txt · Last modified: 2021/03/23 12:22 (external edit)