Based on [WayBack] version control – How do I do an initial push to a remote repository with Git? – Stack Overflow, this is what I do:
On the server
mkdir my_project.git cd my_project.git git --bare initOn the client
mkdir my_project cd my_project touch .gitignore git init git add . git commit -m "Initial commit" git remote add origin youruser@yourserver.com:/path/to/my_project.git git push --set-upstream origin master
The last one is important, especially when you have multiple remotes.
Some servers allow you to skip the server part, as they run them automatically when pushing a new repository from the client.
This can be both an advantage and a disadvantage, for instance when you have typos when adding the remote.
–jeroen