/ git

GIT Remote Server Setup

This should work on any remote server with ssh enabled. I specifically use it on my Synology NAS (with GIT application installed).

1. Create "BARE" Repository on Remote Server

ssh username@remote_server_name -p ssh_port_number
mkdir my_repo.git
cd my_repo.git
git init --bare

Note: The ".git" extension on the my_repo directory is simply a naming convention and is not required.

2. Create Repository on Client Machine (without --bare)

mkdir my_repo.git
cd my_repo.git
git init

3. Create Remote Server Reference on Client Machine

git remote add origin ssh://username@remote_server_name:ssh_port_number/path/to/my_repo.git

4. Add and Commit Some Files on Client Machine

echo "I'm a test file" > test.txt
git add *
git commit -m "Some comments about my commit"

5. Push Changes to Remote Server

git push origin --all