From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- public/articals/linux/server/git.html | 197 ---------------------------------- 1 file changed, 197 deletions(-) delete mode 100644 public/articals/linux/server/git.html (limited to 'public/articals/linux/server') diff --git a/public/articals/linux/server/git.html b/public/articals/linux/server/git.html deleted file mode 100644 index c02953c..0000000 --- a/public/articals/linux/server/git.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - Git server setup! - - - - -
- -
-
-

How to start your own epic Git server!

-

Date: 23-02-2025

-
-

Quick guide on how to set up a git server with stagic html website.

-
- -

What you will need 📋

- -
- -

Setting up Git server

-
- -
  • 1) Install Git
  • -
    -
    -

    # sudo apt install git

    -
    -
    - -
    - -
  • 2) Create git user.

  • -
    -

    # sudo adduser git

    -
    - -
    - -
  • 3) Now you need to add your SSh keys.

  • -
    -

    On server

    -

    # su git

    -

    $ cd

    -

    $ mkdir .ssh && chmod 700 .ssh

    -

    $ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

    -
    - -
    - -
    -

    On computer

    -

    $ cat .ssh/id_rsa.pub

    -
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyXwuFdbWHloGPOfFq6p5Dt..... me@shipwreckt.co.uk
    -

    Copy and paste your ssh key to .ssh/authorized_keys on your server. -

    - -

    If you want to allow other people to use your Git server, add their SSH keys alongside yours.

    - -
    - -
  • 4) Nearly done, now all you need to do is make a git repo.

  • -
    -

    # chown git:git /srv/git

    -

    # su git

    -

    $ cd /srv/git

    -

    $ mkdir yourrepo.git

    -

    $ cd yourrepo.git

    -

    $ git init --bare

    -
    - -
    - -
  • 5) Time to add your server to your local repo
  • -
    -

    On computer

    -

    $ cd yourrepo

    -

    $ git init

    -

    $ git add .

    -

    $ git commit -m 'Initial commit'

    -

    $ git remote add origin git@gitserver:/srv/git/project.git

    -

    $ git push origin master

    -
    - -

    If you already have a Git repository from another server, you can do the following to add your new Git server alongside your old one.

    - -
    -

    On computer

    -

    $ cd yourrepo

    -

    $ git remote add server git@gitserver:/srv/git/project.git

    -

    $ git push server master && git push origin master

    -
    - -

    You can now do this for all of your repos!

    - -
    - -
  • 6) If you want to enable anybody to clone from your website do the following!
  • - -
    -

    # sudo git daemon --reuseaddr --base-path=/srv/git/ /srv/git/ &

    -

    # sudo systemctl enable git-daemon

    -

    # sudo systemctl start git-daemon

    -

    # su git

    -

    touch /srv/git/project.git/git-daemon-export-ok

    -
    - -

    Cloning your git repo

    -
    -

    On computer

    -

    git clone git://your-server-ip-address/repository.git

    -
    -

    Now you should be able to be able to clone without a ssh key!

    - -
    -

    Setting up Stagit for personal git website

    -

    Now that you have a Git server, you probably want a way to show off all of your repositories. I personally use Stagit for this because it is lightweight and stylish. I will assume you know how to make a website using Apache or Nginx.

    - -
    -
  • 1) First you need to install stagit, I have my own custom fork to make it easier to setup.
  • -
    -

    # cd /var/www

    -

    # git clone git://shipwreckt.co.uk/stagit-fork.git

    -

    # mkdir git

    -

    # chown git:git git

    -

    # mv stagit-fork/* git

    -

    # cd git

    -

    # sudo make clean install

    -
    - -
    -
  • 2) Setup website.
  • -
    -

    # cd htmldir

    -

    # sh example_create.sh

    -
    -

    Your static stagit website should be generated for you! Check by going to git.yourdomain.com. - -


    - -
  • 3) Next you want to set up ownership, links, and descriptions for stagiit to display
  • -
    -

    Descriptions

    -

    # This is my git repo > /srv/git/yourrepo.git/description

    -
    - -
    -

    URL

    -

    # git://yourdomain.com/yourrepo.git > /srv/git/yourrepo.git/url -

    - -
    -

    Owner

    -

    # owner > /srv/git/yourrepo.git/owner

    -
    - -
    -

    Update stagit

    -

    # sh /var/www/git/htmldir/example_create.sh

    -
    - -

    Now repete for all of your repos till all is correct!

    - -
    -
  • 3) Now you want it so stagit updates whenever there is an update, thankfully for you I have modified the script to work whenever a git commit is made!
  • -
    - # cp /var/www/git/example_post-receive.sh /srv/git /srv/git/yourgitrepo.git/hooks/post-receive -
    -

    Now whenever you push a commit everything should update!


    - -

    Overview

    -

    I hope this guide has helped you setup a kool git server! If there are any problems please contact me!

    - -
    -
    -
      Back 🚪
    -    
    - - - -- cgit v1.2.3