January 2, 2010

notes for setting up a remote git repo (ssh transport)

grrr, i keep forgetting the order of operations here …

on the main server create the directory and initialize a bare repo on the server.

initialize repository

% mkdir path_to_repo
% cd path_to_repo
% git --bare init

from the local machine with your content/code, add the remote origin and push your code to the repo.

push it to the remote master:

% cd path_to_local_source
% git remote add origin ssh://hostname/path_to_repo
% git push origin master

share it or get it from another location …

% git clone ssh://hostname/path_to_repo

assumes that the person has an account on the host with the appropriate permissions to modify or read the repo contents.

pull changes from the server to pick up the latest …

% git pull origin master

Creative Commons License