zoukankan      html  css  js  c++  java
  • gitlab配置ssh key

    测试服务上使用ip访问gitlab,比如http://192.168.3.20/,这里用http://IP表示。

    一,在gitlab上新建项目,点击进入后会有Command line instructions

    Git global setup
    git config --global user.name "Administrator"
    git config --global user.email "admin@example.com"
    
    Create a new repository
    mkdir bbs
    cd bbs
    git init
    touch README.md
    git add README.md
    git commit -m "first commit"
    git remote add origin git@192.168.3.20:interaction/bbs.git
    git push -u origin master
    
    Push an existing Git repository
    cd existing_git_repo
    git remote add origin git@192.168.3.20:interaction/bbs.git
    git push -u origin master
    

    二  .配置windows ssh key

       1) 如果你是windows,并且安装了tortoise,那在tortoise安装目录下,比如C:Program FilesTortoiseGitin,会有一个产生密钥对的工具puttygen.exe,

       打开puttygen.exe,点击Generate,注意,需要鼠标在进度条下的空白区域不停的晃动,它会根据鼠标位置来随机产生密钥对:

     

    2)复制上面的ssh-rsa公钥到gitlab下,位置http://IP/profile/keys->add ssh key

    3) 保存私钥save private key , 一般保存在C:UsersAdministrator下的一个目录里, 我放在了.ssh下,如果没有此目录可以建一个其他的目录(windows不允许自建目录‘.’开头,随便起一个就可以了)

    4 )在本地项目中选择该私钥

       注意,该项目需要已经在git管理下

      右键git setting->remote->putty选择上一步保存的ppk文件。

    5) 设置ssh客户端:tortoise git->  setting->network->ssh client->TortoiseGitPlink.exe

    6)在项目git clone和 git pull git push的时候,勾选autoload putty key,(如果上一步的ssh 客户端选错可能导致此处为灰色无法勾选)

    7) 试一下push和pull功能,应该就需要再输入密码了。

    三、配置linux ssh key 

    执行命令:ssh-keygen -t rsa -C "xx@xx.com" (这里写自己的邮箱),一路回车,生成密钥对:

    $cat /root/.ssh/id_rsa.pub

      复制公钥到gitlab,操作同windows的第三步。

      完成。

  • 相关阅读:
    hibernate篇章六--demo(Hibernate之第1解之-hibernate_demo_1)
    hibernate篇章六--demo(0.准备工作)
    博客装扮3-博客园界面装扮优化教程
    java学习笔记--1_常见输入输出语句熟悉篇章
    矩阵相乘问题
    Algorithm
    hibernate篇章五--Hibernage工作原理
    hibernate篇章四-- Hibernate配置文件中hiberante.hbm2ddl.auto四个参数的配置
    hibernate篇章三-- hibernate配置文件hibernate.cfg.xml的详细解释
    hibernate篇章二--成就搭建hibernate框架
  • 原文地址:https://www.cnblogs.com/mumusen/p/7654696.html
Copyright © 2011-2022 走看看