-2

Before I install git, I have a local folder /c/kuaipan/Django/exam and a remote server whose ip is 111.11.111.11 and username is root. Now I just want push all contents of exam to server /home/mygit.

So I first create a bare repository /home/git on server then create a repository for loacal exam and push it to server. The infomation seems to be all right. I use ls hoping to see there is a exam folder or contents of it in mygit but there isn't. So what should I do? Where I am wrong.(my git username is "xiangnan" and git email is "280145668@qq.com").

Here is what I try:

# remote server
root@remoteuser:/home# cd mygit
root@remoteuser:/home/mygit# git --bare init
Initialized empty Git repository in /home/mygit/

# local
Administrator@localuser /c/kuaipan/Django/exam (master)
$ git remote add origin ssh://root@111.11.111.11/home/mygit
Administrator@localuser /c/kuaipan/Django/exam (master)
$ git push -u origin master
root@111.11.111.11's password:
Counting objects: 175, done.
Compressing objects: 100% (167/167), done.
Writing objects: 100% (175/175), 418.90 KiB | 0 bytes/s, done.
Total 175 (delta 18), reused 0 (delta 0)
To ssh://root@111.11.111.11/home/mygit
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

# remote server
root@remoteuser:/home/mygit# ls
bin       config       HEAD   include  lib      refs
branches  description  hooks  info     objects
xiang
  • 363
  • 3
  • 13

1 Answers1

0

By definition, bare repositories don't include a working copy. They're effectively just .git/ directories.

If you want your code to be automatically deployed when you push, you should look into setting up a deploy hook, as described in Deploy a project using Git push.

Community
  • 1
  • 1
Chris
  • 93,263
  • 50
  • 204
  • 189