我是靠谱客的博主 耍酷长颈鹿,最近开发中收集的这篇文章主要介绍git 安装及配置,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1.https://github.com/ 注册,略...

2.创建一个新的工程

3.下载git客户端,选择git安装目录,略...

下载地址:https://git-for-windows.github.io/

4.生成秘钥

ssh-keygen -t rsa -C "your@email.com"

成功如下:

 

5.进入到安装目录下,查看生成的秘钥

 

6.登录github.com配置秘钥

链接github确认添加的ssh公共密钥是否有效
ssh git@github.com

The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi xxxuser! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Administrator@USER-20160524DB MINGW64 ~/Desktop

出现上面所示:

Warning: Permanently added the RSA host key for IP address '192.30.255.113' to the list of known hosts.

解决:在hosts文件夹下添加如下:

192.30.255.113  github.com

The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?

解决:查看ssy是否存在:$ ls -al ~/.ssh

重新生成和配置sshkey第4步和第五步

 

正常显示如下:

$ ssh git@github.com
//正常情况下,回显如下
PTY allocation request failed on channel 0
Hi plinx! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

 

 

 

7.配置github远程仓库

如果是第一次配置github远程仓库,需要设置用户名和邮箱,并添加远程地址,给远程仓库起个别名

git config --global user.name "github用户名"
git config --global user.email "your_github_email@qq.com"
git remote add origin( origin:别名) git@github.com:yourName/yourRepo.git

 

 

转载于:https://www.cnblogs.com/lichihua/p/9174505.html

最后

以上就是耍酷长颈鹿为你收集整理的git 安装及配置的全部内容,希望文章能够帮你解决git 安装及配置所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(33)

评论列表共有 0 条评论

立即
投稿
返回
顶部