Skip to content

Instantly share code, notes, and snippets.

@BeastGamer81
Forked from hoyin258/git_setup.md
Created February 14, 2022 07:25
Show Gist options
  • Save BeastGamer81/0eee83ba5289a5dbc3dc12f8acea732c to your computer and use it in GitHub Desktop.
Save BeastGamer81/0eee83ba5289a5dbc3dc12f8acea732c to your computer and use it in GitHub Desktop.
VPS Git Server Setup

Create repository

VPS:

su
cd /var/www/
mkdir site
cd /var
mkdir repo && cd repo
mkdir site.git && cd site.git
git init --bare
cd hooks
cat > post-receive
chmod +x post-receive
#!/bin/sh
git --work-tree=/var/www/site --git-dir=/var/repo/site.git checkout -f

(Press Ctrl+D to exit)

Local

mkdir project
cd project
git init
touch file
git add .
git commit - m "Add project"
git remote add beta ssh://user@mydomain.com:port/var/repo/site.git
git push remote master

Permission Problem

ssh user@mydomain.com:port
cd /var/repo/site.git

sudo chmod -R g+ws *
sudo chgrp -R mygroup *

git config core.sharedRepository true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment