Skip to main content
  • Create new account
  • Reset your password
张文涛的个人博客
致力于提供Drupal开发,实践等方面的精品资讯

Main navigation

  • 首页
  • 关于
  • Glossary
  • 分享

Breadcrumb

  • Home
  • Bluehost上安装git服务器及创建远程版本库
By admin | 9:14 AM CST, Sat January 18, 2014

个人一直在用bluehost,比这个博客目前也托管在bluehost.

1. 在bluehost上搭建git服务器
Step1:查bluehost操作系统版本, 一般都显示Red Hat x.x.x

>> cat /proc/version

Step2:下载git安装包

>> wget http://kernel.org/pub/software/scm/git/git-1.7.5.4.tar.bz2

注意:要到http://kernel.org上去查最新的git latest stable版本号,然后拼出地址

Step3: 解压安装

>> tar -xjvf git-1.7.5.4.tar.bz2
>> cd git-1.7.5.4
>> make
>> make install

Step4: 测试git

>> git --version

Step5: 建立git工程

>> cd ~
>> mkdir git
>> mkdir myproject.git
>> cd myproject.git
>> git --bare init

2. 在本地计算机启动git shell, 建立工作目录
>> cd d:/work
>> mkdir myproject
>> cd myproject
>> git init
>> git remote add origin ssh://USERNAME@YOURDOMAIN.com/~/git/myproject.git
>> touch .gitignore
>> git add .
>> git commit -m "initial commit"
>> git push origin master

注意:在执行最后一个指令:git push origin master时,会报一个错误:git-receive-pack: command not found, 解决方法是:编辑本地仓库目录下.git/config文件,如下所示:

>> vim .git/config

编辑内容:
[remote "origin"]
url = ssh://USERNAME@YOURDOMAIN.com/~/git/myproject.git
fetch = +refs/heads/*:refs/remotes/origin/*
uploadpack=/home2/USERNAME/bin/git-upload-pack
receivepack=/home2/USERNAME/bin/git-receive-pack
就是把git-upload-pack, git-receive-pack两个可执行文件的地址显示的写出来,这里的/home2/USERNAME/bin/就是bluehost上安装git的目录,每次建立一个新的本地仓库,都需要编辑这个文件。

3. 提交文件
>> cd d:/work/myproject
>> vim test.txt
>> git add test.txt
>> git commit -m "test commit"
>> git push

4. 在另一个工作机器上checkout工程
>> git clone ssh://USERNAME@YOURDOMAIN.com/~/git/myproject.git

Glossary

  • May 2023 (7)
  • March 2023 (1)
  • October 2022 (1)
  • October 2021 (2)
  • August 2021 (4)
  • June 2021 (2)
  • May 2021 (1)
  • April 2021 (2)
  • November 2020 (1)
  • June 2020 (2)
  • December 2019 (2)
  • November 2019 (1)
  • August 2019 (1)
  • February 2018 (1)
  • October 2017 (1)
  • September 2017 (1)
  • July 2017 (1)
  • June 2017 (2)
  • May 2017 (1)
  • March 2017 (3)
  • December 2016 (2)
  • November 2016 (4)
  • October 2016 (3)
  • June 2016 (1)
  • December 2015 (1)
  • November 2015 (6)
  • October 2015 (2)
  • September 2015 (1)
  • August 2015 (1)
  • July 2015 (1)
  • June 2015 (1)
  • May 2015 (1)
  • March 2015 (1)
  • January 2015 (1)
  • December 2014 (3)
  • October 2014 (5)
  • September 2014 (3)
  • August 2014 (1)
  • July 2014 (1)
  • June 2014 (1)
  • May 2014 (1)
  • April 2014 (2)
  • March 2014 (2)
  • February 2014 (2)
  • January 2014 (4)
  • December 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • December 2012 (2)
  • November 2012 (4)
  • October 2012 (1)
  • September 2012 (6)
  • August 2012 (15)
  • July 2012 (5)
  • June 2012 (13)
  • May 2012 (9)
  • April 2012 (8)
  • March 2012 (9)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (1)
  • November 2011 (6)
  • October 2011 (2)
  • September 2011 (17)
  • August 2011 (4)
  • July 2011 (4)
  • June 2011 (5)
  • May 2011 (4)

Copyright © 2025

苏ICP备14044171号-1