zoukankan      html  css  js  c++  java
  • gitlab两种连接方式:ssh和http配置介绍 --转自 散尽浮华

    gitlab环境部署好后,创建project工程,在本地或远程下载gitlab代码,有两种方式:ssh和http

    1)ssh方式:这是一种相对安全的方式
    这要求将本地的公钥上传到gitlab中,如下图:

    window客户机设置ssh方式连接gitlab,请见:http://www.cnblogs.com/kevingrace/p/5651402.html(文章底部有介绍)

    2)http连接方式

    这种方式要求project在创建的时候只能选择“Public”公开状态,Private和Internal私有模式下不能使用http方式进行连接。(ssh方式在三种模式下都可以)。使用http方式直接连接gitlab显然没有ssh连接方式安全,但是也可以做些安全设置,比如在gitlab本机的iptables里做端口限制(如上是8081端口),添加白名单等。

    2)git push则不允许,没有权限

    [root@test ~]# touch README.md
    [root@test ~]# git add README.md
    [root@test ~]# git commit -m "add README"
    [root@test ~]# git push -u origin master
    .......
    remote: GitLab: You are not allowed to push code to protected branches on this project.
    To http://gitlab.kevin-inc.com/fanglianchao/scanhost.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'http://gitlab.kevin-inc.com/fanglianchao/scanhost.git'
     
    需要将kevin用户加入到scanhost.git项目仓库的member权限里,这样就有权限进行git push了!
    ***************当你发现自己的才华撑不起野心时,就请安静下来学习吧***************
  • 相关阅读:
    496. 下一个更大元素 I『简单』
    492. 构造矩形『简单』
    443. 压缩字符串『简单』
    455. 分发饼干『简单』
    463. 岛屿的周长『简单』
    38. 外观数列『简单』
    28. 实现 strStr()『简单』
    441. 排列硬币『简单』
    628. 三个数的最大乘积『简单』
    575. 分糖果『简单』
  • 原文地址:https://www.cnblogs.com/RyanJin/p/9372242.html
Copyright © 2011-2022 走看看