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


  • 相关阅读:
    在SQLite中使用索引优化查询速度
    SQLite支持的SQL数据操作
    left (outer) join , right (outer) join, full (outer) join, (inner) join, cross join 区别
    深入理解Android内存管理原理(六)
    Merge Sorted Array
    Sort Colors
    Construct Binary Tree from Preorder and Inorder Traversal
    Binary Tree Postorder Traversal
    Symmetric Tree
    Rotate Image
  • 原文地址:https://www.cnblogs.com/konlil/p/2091699.html
Copyright © 2011-2022 走看看