I\'m trying to use git to deploy my local code in my remote server.
So here is what I\'ve done in my local folder mywebsite/ :
git init
git add .
This will answer your question
http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/
In bare repository you don't need to have source.
You've created a remote repository without a working directory (which is the purpose of the --bare
option). What you need to do next is clone that remote repository into your website directory. I use the same approach; I have a ~/git directory with one or more bare git repositories and then clones for one or more web sites. Your steps could be:
# locate your bare repository in a 'git' directory
remote$ mkdir ~/git; mkdir ~/git/mywebsite.git; cd ~/git/mywebsite.git; git init --bare
# set this up as your remote
local$ git remote add origin ssh:.../git/mywebsite.git
local$ git push origin ...
# on the remote, clone into your working website
remote$ cd ~/public_html
remote$ git clone ~/git/mywebsite.git mywebsite
Using this approach you can develop locally, push to remote as often as you like and then, when you are ready, git pull
on the remote to actually update the website.