Skip to content

Instantly share code, notes, and snippets.

@rsgalloway
Last active September 21, 2018 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsgalloway/6585583411f41e26e30555a083a928b2 to your computer and use it in GitHub Desktop.
Save rsgalloway/6585583411f41e26e30555a083a928b2 to your computer and use it in GitHub Desktop.
Instructions for setting up remote git server

Instructions for setting up remote git server

setup a new git repo on server:

  • repo name can be anything (but usually they end in .git)

for synology NAS diskstations, you probably want your git repos under /volume1

$ ssh <user>@<server>
$ cd /srv/git
$ mkdir <repo>
  • make sure that the users group has write access.
$ chgrp users <repo>
$ chmod g+sw <repo>
  • initialize the bare repo with shared permissions:
$ cd <repo>
$ git init --bare --shared=group

note: this is not a working copy, only a master repo. you can't add files to this. to push data from a local working copy, set up the repo on your local workstation and push to the server.

committing files

  • create local clone of repo
$ git clone <server>:/srv/git/<repo>
$ echo "this is a test" > foo.txt
$ git add foo.txt
$ git commit -a -m "initial commit"
$ git push origin master
  • for read-only access using git user:

https://www.linux.com/learn/how-run-your-own-git-server

$ git clone git@<server>:/srv/git/<repo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment