zoukankan      html  css  js  c++  java
  • Ubuntu 14.04搭建简单git服务器

    /******************************************************************************
     *                     Ubuntu 14.04搭建简单git服务器
     * 说明:
     *     由于最近需要搭建一下git服务器,记录一下一些疑虑和遇到的一些问题。
     *
     *                                          2016-6-7 深圳 南山平山村 曾剑锋
     *****************************************************************************/
    
    一、参考文档:
        1. 搭建Git服务器
            http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137583770360579bc4b458f044ce7afed3df579123eca000
        2. Git问题集锦
            http://www.cnblogs.com/gsblog/p/3699209.html
        3. ssh: connect to host localhost port 22: Connection refused 
            http://blog.csdn.net/zlm_250/article/details/7979221
        4. Chapter 4 Git on the Server
            https://git-scm.com/book/en/v1/Git-on-the-Server
    
    二、以下是等效推送,其他类似:
        1. 第一次推送:
            git push git@192.168.1.9:/home/git/repos/sample.git master
            git push git@192.168.1.9:repos/sample.git master
        2. 后续推送:
            git push git@192.168.1.9:/home/git/repos/sample.git
            git push git@192.168.1.9:repos/sample.git
    
    三、为什么在仓库里看不到源代码:
        A remote repository is generally a bare repository — a Git repository that has no working directory. Because the repository is only used as a collaboration point, there is no reason to have a snapshot checked out on disk; it’s just the Git data. In the simplest terms, a bare repository is the contents of your project’s .git directory and nothing else.
        一个远程仓库一般是一个纯仓库,一个git仓库没有工作目录。由于仓库仅仅用于收集节点,所以没有必要保留快照,所以仓库只保留git数据。因此,一个纯仓库只包含项目下的.git目录。
    
    四、出现的问题:
        git@zengjf:~/testforrepos/sample$ git push git@192.168.1.9:/home/git/repos/sample.git
        warning: push.default is unset; its implicit value is changing in
        Git 2.0 from 'matching' to 'simple'. To squelch this message
        and maintain the current behavior after the default changes, use:
    
          git config --global push.default matching
    
        To squelch this message and adopt the new behavior now, use:
    
          git config --global push.default simple
    
        When push.default is set to 'matching', git will push local branches
        to the remote branches that already exist with the same name.
    
        In Git 2.0, Git will default to the more conservative 'simple'
        behavior, which only pushes the current branch to the corresponding
        remote branch that 'git pull' uses to update the current branch.
    
        See 'git help config' and search for 'push.default' for further information.
        (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
        'current' instead of 'simple' if you sometimes use older versions of Git)
    
        No refs in common and none specified; doing nothing.
        Perhaps you should specify a branch such as 'master'.
        fatal: The remote end hung up unexpectedly
        error: failed to push some refs to 'git@192.168.1.9:/home/git/repos/sample.git'
        git@zengjf:~/testforrepos/sample$ git push git@192.168.1.9:/home/git/repos/sample.git master
        Counting objects: 3, done.
        Writing objects: 100% (3/3), 243 bytes | 0 bytes/s, done.
        Total 3 (delta 0), reused 0 (delta 0)
        To git@192.168.1.9:/home/git/repos/sample.git
         * [new branch]      master -> master
  • 相关阅读:
    2015 10月21日 工作计划与执行
    2015 10月20日 工作计划与执行
    2015 10月19日 工作计划与执行
    排序算法之归并排序 分类: C/C++ 数据结构与算法 2015-06-29 16:46 190人阅读 评论(0) 收藏
    sublime个人配置(C++程序员) 分类: C/C++ 2015-06-29 09:29 95人阅读 评论(0) 收藏
    排序算法之简单排序 分类: C/C++ 2015-06-29 08:14 252人阅读 评论(0) 收藏
    profile与bashrc 分类: Ubuntu学习笔记 2015-06-26 14:42 146人阅读 评论(0) 收藏
    leetCode(26):Unique Binary Search Trees 分类: leetCode 2015-06-23 14:09 155人阅读 评论(0) 收藏
    leetCode(25):Validate Binary Search Tree 分类: leetCode 2015-06-23 13:00 154人阅读 评论(0) 收藏
    leetCode(24):Binary Search Tree Iterator 分类: leetCode 2015-06-23 11:50 192人阅读 评论(0) 收藏
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5566128.html
Copyright © 2011-2022 走看看