http://www.cnblogs.com/my_life/category/636271.html
远程仓库实际上和本地仓库没啥不同,纯粹为了7x24小时开机并交换大家的修改。
选定一个目录作为Git仓库,初始化Git仓库:
git init --bare sample.git
Git就会创建一个裸仓库,裸仓库没有工作区,因为服务器上的Git仓库纯粹是为了共享,所以不让用户直接登录到服务器上去改工作区,并且服务器上的Git仓库通常都以.git
结尾。
创建一个git
用户,用来运行git
服务
adduser git
chown -R git:git sample.git
现在,可以通过git clone
命令克隆远程仓库了(如果远程仓库有代码)
$ git clone git@server:/path/to/sample.git
git clone ssh://user@hostname:port/path/to/xxx.git
=====
客户端
git remote add remote_server_alias ssh://user@host:port/path/to/example.git
git remote -v
git push remote_server_alias master (将本地代码上传到远端空仓库)