Git 仓库

GIt 传输协议

  1. 本地协议
    $ git clone file:///opt/git/project.git
    优点 : 可以直接使用文件系统的权限,和网络权限。
    缺点:共享文件系统比较难配置,协议并不保护仓库避免意外的损坏

  2. HTTP 协议
    $ git clone https://example.com/gitproject.git
    优点:可以使用 用户名/密码授权, HTTP/S 协议被广泛使用,一般的企业防火墙都会允许这些端口的数据通过
    缺点:架设 HTTP/S 协议的服务端会比 SSH 协议的棘手一些

  3. SSH 协议
    $ git clone ssh://user@server/project.git
    优点:SSH 架设相对简单,SSH 协议很高效,在传输前也会尽量压缩数据,传输数据都要经过授权和加密
    缺点:SSH 协议的缺点在于你不能通过他实现匿名访问,不利于开源

  4. Git 协议 ( 不建议 )
    优点: Git 协议是 Git 使用的网络传输协议里最快的
    缺点: Git 协议缺点是缺乏授权机制

服务器建立裸仓库 ( 加上 --shared git 会自动修改该仓库目录的组权限为可写 )

$ git init --bare --shared

搭建方法

https://progit.bootcss.com/#_%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84_git

存储凭证

$ git config --global credential.helper cache    [ 凭证存放在内存中一段时间  15分钟 ]
$ git config --global credential.helper store     [ 凭证用明文的形式存放在磁盘中,并且永不过期 ]

.gitconfig 配置文件如下:

[credential]     
helper = store --file /mnt/thumbdrive/.git-credentials
helper = cache --timeout 30000

客户端配置选项

  1. 修改编辑器 [ vim emacs ]
    $ git config --global core.editor emacs
  2. 修改提交(commit)的默认信息
    $ git config --global commit.template ~/.gitmessage.txt [.gitmessage.txt 定义内容]
  3. 一页显示所有内容
    $ git config --global core.pager ''
  4. 回车和换行问题
    $ git config --global core.autocrlf true [ window linux 联合开发 ]
    $ git config --global core.autocrlf input
    $ git config --global core.autocrlf false [ 仅在windos下 开发]

服务端选项

  1. push 检测 有效性以及 SHA-1 检验和是否保持一致
    $ git config --system receive.fsckObjects true
  2. 禁止 push -f 强制更新
    $ git config --system receive.denyNonFastForwards true
git
本作品采用《CC 协议》,转载必须注明作者和本文链接
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!