Git服务器的建立

据我目前所知,在团队中使用GIT作为SERVER好像不是太多,这两天试了一下,主要是觉得在各台机之间传代码会方便一点,因为有时候在WIN下开发,有时在LINUX下开发。而这个作为交换的空间也只是作为暂存用,用完之后要删掉的。

 

 

网上大部分的介绍是从头建立一个GIT REPOSITORY,而我的需求是把现有的GIT仓库转移到LINUX主机上,供多台机获取及上传等。

在GIT主站找到了以下链接:

http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#setting-up-a-public-repository

摘录部分文字如下:

Setting up a public repository

Assume your personal repository is in the directory ~/proj. We first create a new clone of the repository and tell git daemon that it is meant to be public:

$ git clone --bare ~/proj proj.git
$ touch proj.git/git-daemon-export-ok

The resulting directory proj.git contains a "bare" git repository—it is just the contents of the ".git" directory, without any files checked out around it.

Next, copy proj.git to the server where you plan to host the public repository. You can use scp, rsync, or whatever is most convenient.

 

使用上述的git clone --bare ~/proj proj.git则可以把现有的GITREPOSITORY导出来。而第二步则会后续的步骤做准备

 

在设置的过程中遇到以下几个错误,记录一下,可能以后用得着:

中间捣鼓了一阵,后来发现连不上了。出现如下错误

could not create a socket listening to 9148

解决方案是: 找到现有的GIT daemon(ps -aux | grep "git"),然后kill掉,再重新启动

find the git daemon process and kill it 

then restart it:

git daemon restart 

 

 

在CLONE的时候遇到如下错误

fatal: 'proj.git' does not appear to be a git repository

fatal: The remote end hung up unexpectedly

如何解决

git clone laijw@192.168.0.2:/var/opt/git_repos/proj .

用全路径解决了问题

 

 

 

GIT确实强大,我之前结合SVN与GIT一起使用,只是用到了在本地的一些操作,而与SERVER的交互实际上还是SVN的交互。后面我想要学习的是GIT与GIT SERVER之间的交互。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值