• linux 下首次使用github 和其中遇到的问题


    1首先安装git

    sudo apt-get install git

    2配置git文件

    git config --global user.name "你的用户名"
    git config --global user.email "你的邮箱"

    3,创建SSH Key

    用户主目录下, .ssh目录下,看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果有,可以删除重新建或者直接略过这一步。
    
    创建SSH Key
    
    ssh-keygen -t rsa -C "邮箱地址"
    
    如果有提示一路enter下去,不用输入啥信息
    
    完成时 会提示你的 id_rsa和id_rsa.pub所在路径 

    4,添加Key至GitHub

      复制id_rsa.pub文件的内容,进入GitHub网站,打开Account Settings,左边选择SSH Keys,Add SSH Key,,粘贴SSH Key

    你的邮箱会收到一个消息, 点进去,

    5、验证ssh key是否设置成功

    执行命令ssh -T git@github.com
    
    如果提示access dennied就是没设置成功
    
    提示You’ve successfully authenticated, but GitHub does not provide shell access
    
    但是我在这里遇到了错误
    
    ssh: connect to host github.com port 22: Connection timed out

    解决方案:

    sudo vim /etc/ssh/ssh_config
    
    在这里末尾面添加 
    
    HOST github.com
    User git   
    Hostname ssh.github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
    Port 443
    
    User 和 git 有人建议写上自己的登录名或者邮箱, 但是我写了报错,所以就没写, 就写User git ,这样就行了
    
    如果不在这里写的话, 也可以在 ./ssh/ 目录下创建一个config文件
    
    vim config 
    
    然后将上述代码添加进去就行了
    
    You've successfully authenticated, but GitHub does not provide shell access.
    
    表示成功 
    View Code

    6初始化本地仓库

    在你要上传的项目 目录下中 执行 git init 

    7,提交文件

      1)或在命令行上创建新的存储库
    
      echo "# mydemo" >> README.md    
    
      git add README.md
    
      git commit -m "first commit"
    
      git remote add origin https://github.com/LXiaoKang/web.git
    
      git push -u origin master
    提交文件
      1)或在命令行上创建新的存储库
      git add .    跟踪项目文件夹中的所有文件和文件夹
    
      git commit -m "first commit"   输入本次的提交说明,准备提交暂存区中的更改的已跟踪文件,单引号内为说明内容
    
      git remote add origin https://github.com/LXiaoKang/web.git
    
      git push -u origin master

    在这里我有遇见了一个错误

    ERROR: Repository not found.
    fatal: 无法读取远程仓库。
    
    请确认您有正确的访问权限并且仓库存在。

    解决方案

    git remote set-url origin https://github.com/LXiaoKang/web.git
    git push -u origin master

    这里的连接 https://github.com/LXiaoKang/web.git

    是你 创建的项目处的 url

  • 相关阅读:
    代码重构编译---make
    clickhouse日期函数
    连续登陆天数+最大登陆天数
    clickhouse基本使用
    数组
    CK优化
    Hive查询优化~布隆过滤器使用
    Presto常见问题优化
    Presto原理解析
    几种排序说明
  • 原文地址:https://www.cnblogs.com/xiaokang01/p/9648160.html
Copyright © 2020-2023  润新知