zoukankan      html  css  js  c++  java
  • Bluehost上安装git服务器

    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


  • 相关阅读:
    jquery+ajax+ashx。ashx的使用方法
    如何在ashx页面获取Session值
    模式DIV。
    .net 中文传参
    5分钟无操作,退出,操作方法,关闭页面
    SQL Server DATEDIFF() 函数(SQL计算时间差)
    Sql server 事务的两种用法
    正则表达式相关
    jQuery AJAX实现调用页面后台方法。调用ashx方法
    时间差(类.精确到秒).net中实现Datediff类C#
  • 原文地址:https://www.cnblogs.com/konlil/p/2091699.html
Copyright © 2011-2022 走看看