zoukankan      html  css  js  c++  java
  • Ubuntu 下连接Github

      Ubuntu下一直装着git,但却没怎么用过,因为连接到github一直没试,今天中午按着Github的指示一步步完成了连接。

      系统中首先得有ssh,没得话装一个。然后进入~/.ssh文件夹中,运行命令:

    ssh-keygen -t rsa -C "your_email@example.com"

      途中会要求输入口令,空着好了,一路Enter。

    1 eval "$(ssh-agent -s)"
    2 ssh-add ~/.ssh/id_rsa

      安装xclip工具用来复制公钥:

    1 sudo apt-get install xclip
    2 xclip -sel clip < ~/.ssh/id_rsa.pub

      此时可以进入github的设置页面,在SSH keys中添加一个ssh key,直接ctrl v就可以把刚才的公钥加进去。

      这时就可以直接push到github了~

      而且要注意的是整个过程除了安装不要用sudo,否则ssh授权时候会混乱。我乱了后重弄了一遍,还是Permission denied,用ssh -vT git@github.com测试,还是Permission denied,重行ssh-add之后才正常。这里有官方的指导

      以上是用ssh方法连,还可以用https连接,其实https是官方推荐的。Linux下和Windows下授权方式不尽相同。

    Linux下:

    • 输入命令:

      git config --global credential.helper cache
      # Set git to use the credential memory cache
      
    • 改变缓存时间为一个小时:

      git config --global credential.helper 'cache --timeout=3600'
      # Set the cache to timeout after 1 hour (setting is in seconds)

     Windows下:

  • 相关阅读:
    对MySql查询缓存及SQL Server过程缓存的理解及总结
    PhpStorm中如何使用database工具,详细操作方法
    zookeeper 操作命令
    关于 php for zookeeper
    摘抄 <关于 作为>
    php 各种扩展
    http与tcp
    PHP 优化之php -fpm 进程
    MYSQL explain详解[转载]
    各种注释[转载]
  • 原文地址:https://www.cnblogs.com/hyace/p/3831308.html
Copyright © 2011-2022 走看看