If you want to push to GitHub, then your server Git repo don't have to be bare.
It should be bare only if you want to push to your server.
Make sure your username and email are set first
git config --global user.name ausername
git config --global user.email anEmail@com
You can start for now by creating on your server (outside of /var/www/html
, to avoid the git repo itself to be served by your Apache web server) a repo
cd /a/path
git init arepo
cd arepo
git --work-tree=/var/www/html/project add .
git commit -m "First project import"
Once that is done, you can clone that repo as a bare repo:
cd /a/path
git clone --bare arepo
# generates a repo.git folder
(note, I assume your GitHub repo is created completely empty)
If your server has an ssh daemon running, and you have a user account who can access /a/path/repo.git, you can locally do:
cd /a/local/path
git clone auser@aserver:/a/path/arepo.git
cd arepo
You now have the local code on your computer.
After a change, you can push back. But you might want a post-receive hook if you want that change (pushed to the server bare repo) to show up in /var/www/html
as well.