on your local machine:
cd my_project
git init
git add *
git commit -m "Initial commit"
git remote add origin example.com:my_project.git
// add your remote url to your local git repository
git pull -r origin master
// fetch from origin and rebase on master, which will rewind to HEAD and reapply your local commits on top of it