less than 1 minute read

Setup: You have a local machine which can access a server via ssh (user: git). git is installed on the server.

Problem: You setup a git repo locally, started developing and now want to copy the repo to the server.

Method 1: Copying via git

Copied from https://stackoverflow.com/a/22664133/10774817

# on server:
$ mkdir repo && cd repo && git init --bare

# on local machine:
$ cd repo
$ git remote add origin git@myServer.io:repo
$ git push --mirror

Method 2: Manual copying using rsync

Copy the whole folder to the server, e.g. using rsync:

rsync -a /path/to/localRepo git@<SERVER>:<repoName>/

Categories:

Updated: