Reputation: 40718
I am trying to transfer a local git repository to a web server. I followed the approach here: Git: move existing repository from PC to server, clone from server
First I initialized an empty repository on my local machine, and added two files and did a commit.
Then on the server I created a folder /www/git
, and changed to that directory and did
git init --shared --bare
Then on the local machine I run
git remote add server [email protected]:/www/git
Then I did
git push server master
which gave output like:
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 2.13 KiB, done.
Total 4 (delta 0), reused 0 (delta 0)
To [email protected]:/www/git
* [new branch] master -> master
However on the server, I cannot see any of the two files I added on local machine.
If I do ls
in /www/git
I get:
HEAD branches config description hooks info objects refs
but none of these are none of these files and directories are the one I pushed from my local machine.
Upvotes: 2
Views: 273
Reputation: 239240
That's the point of a bare
repository. It has no working directory, and no branch checked out. It's just the .git
directory. It's meant to facilitate pushing and pulling, but not working with the files themselves.
If you want to actually work with the files on the server, you should checkout a non-bare copy of the repo somewhere else on the server. Then your client and server can continue to share code by pushing/pulling from the bare repo.
Upvotes: 6