Skip to content

HarshKapadia2/git-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Git Server

A simple self-hosted Git server (SSH access only).

Setup Instructions

  • Clone this repository

    $ git clone https://github.com/HarshKapadia2/git-server.git
  • Run the setup script.

    $ cd git-server/
    $ ./setup --pwd <value> --default-branch <branch_name>
    # Or
    $ ./setup --help

NOTE:

  • The Git server lives in a new user (and group) called git.
  • Repositories have to be created in /srv/git by the git user.
  • Currently, only SSH access is supported.

Script Arguments

The setup script arguments

  • --pwd <value>
    • Password for the Git server account. Used for SSH as well.
    • Value: A string. An empty string is not allowed.
    • Requirement: Always
  • --default-branch <branch_name>
    • Optionally specify the default branch that Git should use for the initial branch.
    • Value: A string. Default value is master.
    • Requirement: Optional
  • --help
    • Print this command usage instruction.
    • Value: No value should be entered.
    • Requirement: Optional

Adding New Repositories

  • Access the Git server and switch to the git user.

    $ ssh git@server_hostname
  • Create a new directory in /src/git with the name of the repository appended with a .git.

    $ mkdir /srv/git/repo_name.git
  • Inside the newly created directory, create a bare Git repository.

    $ cd /srv/git/repo_name.git
    $ git init --bare

Resources

About

A simple self-hosted Git server.

Topics

Resources

License

Stars

Watchers

Forks

Languages