Ubuntu 14.04搭建简单git服务器

简介: /****************************************************************************** * Ubuntu 14.04搭建简单git服务器 * 说明: * 由于最近需要搭建一下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

 

目录
相关文章
|
9月前
|
Shell Linux 网络安全
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
1458 3
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
|
存储 开发工具 git
[Git] 深入理解 Git 的客户端与服务器角色
Git 的核心设计理念是分布式,每个仓库既可以是客户端也可以是服务器。通过 GitHub 远程仓库和本地仓库的协作,Git 实现了高效的版本管理和代码协作。GitHub 作为远程裸仓库,存储项目的完整版本历史并支持多客户端协作;本地仓库则通过 `.git` 文件夹独立管理版本历史,可在离线状态下进行提交、回滚等操作,并通过 `git pull` 和 `git push` 与远程仓库同步。这种分布式特性使得 Git 在代码协作中具备强大的灵活性和可靠性。
[Git] 深入理解 Git 的客户端与服务器角色
|
网络安全 Apache 开发工具
图解Git——服务器上的Git《Pro Git》
Git 远程仓库及通信协议简介:远程仓库为团队协作提供平台,支持共享代码。常见形式为裸仓库,仅保存 Git 元数据。Git 支持多种协议,包括本地协议(适合局域网)、HTTP/HTTPS(推荐智能 HTTP,安全易用)、SSH(企业内部协作首选)和 Git 协议(高效只读访问)。选择协议需根据协作需求、安全性和配置难度权衡。此外,搭建 Git 服务器涉及创建裸仓库、上传至服务器、初始化共享仓库等步骤。生成 SSH 公钥、配置服务器及使用 GitWeb 或 GitLab 等工具可进一步增强功能。第三方托管服务如 GitHub 提供便捷的托管选项,适合快速启动和开源项目。总结而言,自行运行服务器提
908 11
|
Ubuntu Shell 开发工具
ubuntu/debian shell 脚本自动配置 gitea git 仓库
这是一个自动配置 Gitea Git 仓库的 Shell 脚本,支持 Ubuntu 20+ 和 Debian 12+ 系统。脚本会创建必要的目录、下载并安装 Gitea,创建 Gitea 用户和服务,确保 Gitea 在系统启动时自动运行。用户可以选择从官方或小绿叶技术博客下载安装包。
921 2
|
Linux 开发工具 数据安全/隐私保护
搭建 Git 私人服务器完整指南
本文详细介绍了如何从零开始搭建一个私人的 `Git` 服务器。首先,文章解释了 `Git` 的概念及其优势,并阐述了搭建私人 `Git` 服务器的重要性,包括数据隐私、定制化需求及成本效益。接着,文章分步骤指导读者完成服务器的准备工作,包括操作系统、硬件和网络要求。随后,详细介绍了在不同操作系统上安装 `Git` 的方法,并演示了如何创建 `git` 用户、部署仓库以及设置免密登录。此外,还提供了客户端连接远程仓库的具体步骤,包括 Linux 和 Windows 的操作方式。最后,文章探讨了迁移仓库的方法以及搭建 `Git` 服务器的一些进阶选项。
7721 0
搭建 Git 私人服务器完整指南
|
前端开发 开发工具 git
如何清理 docker 磁盘空间+修改 Gitea 服务器的 Webhook 设置+前端一些好学好用的代码规范-git hook+husky + commitlint
如何清理 docker 磁盘空间+修改 Gitea 服务器的 Webhook 设置+前端一些好学好用的代码规范-git hook+husky + commitlint
435 5
|
网络安全
Ubuntu14.04安装ssh服务器
Ubuntu14.04安装ssh服务器
315 0
|
Ubuntu Linux Windows
Ubuntu 14.04安装samba服务器
Ubuntu 14.04安装samba服务器
312 0
|
Ubuntu 开发工具 git
ubuntu 14.04的git 错误: gnutls_handshake() failed: Handshake failed
本文提供了一个解决Ubuntu 14.04系统上使用Git时遇到的"gnutls_handshake() failed: Handshake failed"错误的脚本,通过替换git的默认加密传输库gnutls为更稳定的openssl,并指导如何编译安装新版本的git来解决问题。
1042 0
|
弹性计算 网络协议 Ubuntu
为ECS Ubuntu 18.04实例配置辅助私网IP地址
本文介绍,如何给Ubuntu 18.04系统配置辅助私网ip。
4503 0
为ECS Ubuntu 18.04实例配置辅助私网IP地址

热门文章

最新文章