当前位置: 移动技术网 > IT编程>网页制作>CSS > git 本地仓库与远程仓库建立连接

git 本地仓库与远程仓库建立连接

2018年12月19日  | 移动技术网IT编程  | 我要评论

我们在使用git clone的时候可能会报错:

  could not read from remote repository.please make sure you have the correct access right

出现问题的原因:

  没有在github账号添加 ssh key

解决方法如下:

  1、打开cmd终端、或者git bash输入:

    ssh-keygen -t rsa -c "123456789@qq.com" 

   如果执行成功则返回 

    generating public/private rsa key pair.
    enter file in which to save the key (/c/users/ibm_admin/.ssh/id_rsa)

  2、出现上步信息后、直接按回车、返回下面信息:

    enter passphrase (empty for no passphrase):

  3、再次回车

    enter same passphrase again:

  4、再次回车

    your identification has been saved in /c/users/ibm_admin/.ssh/id_rsa.
    your public key has been saved in /c/users/ibm_admin/.ssh/id_rsa.pub.
    the key fingerprint is:
    sha256:the secret key string/the secret key string dietime1943@gmail.com
    the key's randomart image is:
    +---[rsa 2048]----+
    |   .+ob++.+ .    |
    | . . *+= + o     |
    |  o @ ...        |
    |   = b.o . +     |
    |    o ..s b .    |
    |   .   *.= o     |
    |    . . =.+      |
    |   . .   =.      |
    |  eoo     .o.    |
    +----[sha256]-----+:

  5、执行到上一步说明ssh key就已经生成了。文件目录就是:/c/users/ibm_admin/.ssh/id_rsa.pub.

    我们执行cat命令查看文件的内容:  

      cat   /c/users/ibm_admin/.ssh/id_rsa.pub.

    这时候会看见:

      ssh-rsa aaaab3nzac1yc2。。。。。。。。。

      (说明:ssh-rsa 后面的内容这就是你的ssh keys)

  6、把显示出来的ssh keys直接添加到github账户设置里边的ssh keys,最后再执行git clone命令就可以了。

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网