-1

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

2 Answers2

3

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.

JSchirrmacher
  • 3,243
  • 2
  • 19
  • 27
  • Thank you for your respose. I tried adding a new file in the same way because there were too many index.html files on the server to look for. find -name "my_new_file.html" find: `./BackupNow/.system': Permission denied and this is what I get. The file seems to be on the server indeed (at least it seems like it could find something), but as you can probably see, it's stuck somewere I can't get to it. – Cristian Bălu Jul 02 '16 at 19:10
  • Do you search in your `--bare` repository or in the checked-out version? As I tried to explain, you won't find the file name in the `--bare` repository, only in checked-out versions. See https://git-scm.com/docs/gitrepository-layout – JSchirrmacher Jul 03 '16 at 05:20
0

Ok, thanks for the answer. For those interested, I realized it was just a conceptual misunderstanding. The files are in fact uploaded on the server, they are just not supposed to be shown inside the bare repository, as it's not supposed to have a working copy.

If you do want a working copy on the remote, you can just git clone the bare repository and it will create a repository with a working copy

  • Hm, is this any different from my answer? – JSchirrmacher Jul 07 '16 at 08:17
  • Hi! No, the answer is the same. I was just thinking that the bare repository does have a working copy as well, so it was a misunderstanding. I posted my solution so that other beginners can see how they can actually get a working copy on the server. Thanks! – Cristian Bălu Jul 07 '16 at 20:29