How to Create a Remote git repository from existing local repository


Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2405 of /data/htdocs/g/giannelli/web/includes/

Problem: You have some existing source in a local git repository and have decided you want to host this on a git server.


Login to remote git server

$ ssh git@
$ mkdir ~/myapp.git; cd ~/myapp.git
$ git --bare init
Initialized empty Git repository in /Users/git/myapp.git/
$ exit

Now associate your local git repository with this remote one and push file:


$ git remote add origin ssh://git@ 
$ git push --set-upstream origin master 
Counting objects: 4981, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4831/4831), done.
Writing objects: 100% (4981/4981), 16.50 MiB | 3.04 MiB/s, done.
Total 4981 (delta 547), reused 0 (delta 0)
To ssh://
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Now you can clone this on any other machine

$ git clone ssh://git@