Miscellaneous git stuff

Making a remote git repository and adding your code to it

Create your local repository first and add your code in the usual way

git init
git add main.c
git commit -m "initial version"

Create the remote repository using ssh replacing MACHINE and NAMEOFPROJECT with the hostname/IP and project name respectively

ssh git@MACHINE git init --bare NAMEOFPROJECT.git

Then add the remote to your local project and push your changes

git remote add origin git@MACHINE:NAMEOFPROJECT.git
git push --set-upstream origin master

And you're done. Next time you just need to do git push.

On the other side

git clone git@MACHINE:NAMEOFPROJECT.git