Search code examples
gitserverhostsourcetree

Pushing to a bare repository on shared hosting


I am trying to set up a git repository on a shared hosting server.

My problem is that after I succesfully created a bare repository on the server and cloned it locally, on my computer, every time I try to add changes -> commit -> push them to the remote branch, only the commit part works.

The push is executed succesfully as well, but no changes seem to be done on the server as well.

mkdir sitrep
cd sitrep
git --bare init

This is how I created the repository on the server

git clone ssh://catlipp1@173.254.28.90/home2/catlipp1/public_html/src-crs/sitrep.git
Cloning into 'sitrep'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

And this is how I cloned it. Now I created a file named index.html and used git add index.html to add the changes and then commit.

Counting objects: 3, done.
Writing objects: 100% (3/3), 217 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
* [new branch]      master -> master

And this is what I get when I try to git push.

Thank you very much in advance


Solution

  • The output looks like the push command did what it should.

    Try to checkout in a second folder. I'm pretty sure that your index.html is present, you only don't see it in your --bare repository.

    Bare repositories are like .git folders in a non-bare one. They contain something like a database for your source files. The files itself are not directly visible in there, the information is stored in database files.