建立私有的git服务

git官方网站上虽然提供私有的git服务,不过是收费的。一个月最少7$。

所以为了节省人民币。自己动手建立自己的git服务端吧。

服务器环境:

site5 虚拟主机

site5

1、在本地已有项目上,建立git仓库

   cd ~/src/myproject

   git init

   git add *

扫描二维码关注公众号,回复: 1191616 查看本文章

   git commit -m "Initial commit"

   添加远程链接的快捷方式

   git remote add origin  ssh://用户名@remote.host.com/~/src/myproject.git

   编辑config

vi .git/config
[branch "master"]
  remote = origin
  merge = refs/heads/master

    加入以上几行

    在你运行 git remote 命令时,应该会出现[remote "origin"]的配置

2、在远程服务器上建立git 服务端

   克隆一个空仓库

   git clone --bare myproject myproject.git
   touch myproject.git/git-daemon-export-ok

3、上传项目

git push origin master

4、在本地导出项目
      git clone ssh://用户名@remote.host.com/~/src/myproject.git

3、接着就可以在本地进行一切git 操作了

   touch README
   git add *
   git commit -m 'first commit'
   git push origin master


4、如果你的虚拟主机不支持git
   就需要你在服务器上自己安装git,并自己在 ~/.bashrc文件中指定 path

===========================

其它的项目托管方

www.unfuddle.com

from:
http://dentharg.wordpress.com/2008/03/03/git-private-repositories-on-shared-hosting/

猜你喜欢

转载自taito.iteye.com/blog/682934