0

I realize that this question has been asked several times. I went through almost all of those before asking it here.

I have a git repo on server A and want it to push on remote server B.

Steps i followed:

On server B:

    mkdir repo
    cd repo
    git init --bare
    ls
    branches  config  description  HEAD  hooks  info  objects  refs

On server A where my local repo is present.

cd localrepo
git remote add new-origin root@B:/root/repo
git push new-origin master
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (12/12), 976 bytes | 0 bytes/s, done.
Total 12 (delta 1), reused 0 (delta 0)
To root@172.16.189.221:/root/four
 * [new branch]      master -> master

Now when i check on server B. Cannot find the updated files. each time i update on localrepo on A and do a push to B. it updates the contents under objects folder in B but am unable to see the files.

Could anyone point me in the right direction :)

  • I'm not too versed in Git, but shouldn't server B be adding the remote and cloning/pulling from server A? – OneCricketeer Dec 17 '15 at 08:32
  • Well i forgot to mention that the pulling worked fine. I was referring to various websites which mention a push. http://www.smashingmagazine.com/2014/05/moving-git-repository-new-server/ http://stackoverflow.com/questions/1484648/how-to-migrate-git-repository-from-one-server-to-a-new-one Just curious to know if i am doing it wrong somewhere. – shridhar Dec 17 '15 at 08:48

1 Answers1

1

A bare repository does not contain a working tree. (That's why it is called bare.) Therefore you cannot see the files directly. (You see only those files, which live in .git on a non-bare repository.)

Use git ls-files to see which files are present. Use git log to see which commits are present.

To actually "move" the repository to another server I would simply use

git clone --mirror $original_url

on the new server.

michas
  • 25,361
  • 15
  • 76
  • 121