本地 新建文件
$ mkdir website && cd website
$ git init
Initialized empty Git repository in /home/ams/website/.git/
$ echo 'Hello, world!' > index.html
$ git add index.html
$ git commit -q -m "The humble beginnings of my web site."
远程
我假定 这个网站你拥有ssh权限 ,并且 你不需要密码就可以登陆
在这个服务器上,我们新建一个仓库来复制本地的那个
$ mkdir website.git && cd website.git
$ git init --bare
然后我们定义一个 可用的post-receive hook 检出最新的树到你的服务器目录中(这个路径必须存在 git 不会为你创建)
$ mkdir /var/www/www.example.org
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
$ chmod +x hooks/post-receive
回到工作(本地) 我们为远程的镜像定义一个名字 ,然后进行推送
$ git remote add web ssh://www-data@192.168.1.193/var/www/mall-wechat/git
$ git push web +master:refs/heads/master