顺便推荐下自己的网站:一个php后台极速开发框架   https://www.lotusadmin.top/

Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置。

github的SSH配置如下:

一 、设置Git的user name和email:

$ git config --global user.name "xuhaiyan"
$ git config --global user.email "haiyan.xu.vip@gmail.com"

二、生成SSH密钥过程:
1.查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
2.生存密钥:

$ ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。 Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………

最后得到了两个文件:id_rsa和id_rsa.pub

3.添加密钥到ssh:ssh-add 文件名
需要之前输入密码。
4.在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。

打开https://github.com/ ,登陆xuhaiyan825,然后添加ssh。

5.测试:ssh git@github.com

The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is ::ac:a5:::2d:::1b::4d:eb:df:a6:.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.

三、 开始使用github
1.获取源码:

$ git clone git@github.com:billyanyteen/github-services.git

2.这样你的机器上就有一个repo了。
3.git于svn所不同的是git是分布式的,没有服务器概念。所有的人的机器上都有一个repo,每次提交都是给自己机器的repo
仓库初始化:

git init

生成快照并存入项目索引:

git add

文件,还有git rm,git mv等等…
项目索引提交:

git commit

4.协作编程:
将本地repo于远程的origin的repo合并,
推送本地更新到远程:

git push origin master

更新远程更新到本地:

git pull origin master

补充:
添加远端repo:

$ git remote add upstream git://github.com/pjhyett/github-services.git

重命名远端repo:

$ git://github.com/pjhyett/github-services.git为“upstream”

Git密钥生成步骤SSH Key的更多相关文章

  1. Git安装以及配置SSH Key——Windows

    安装 安装 Git 官网下载一个Windows版本的Git. 然后一直下一步即可,如下图 环境变量自动配好的,可以去检查一下环境变量中PATH中有没有Git的环境变量 然后在桌面右击鼠标,选择Git ...

  2. Jenkins配置git/github 插件的ssh key

    参考来源:http://jingyan.baidu.com/article/a65957f4f0acc624e67f9bc1.html 方式一:本地需要生成公私钥文件,git/github中新建ssh ...

  3. windows上把git生成的ssh key

    右键鼠标,选中 “Git Bash here”: 输入指令,创建ssh key: cd ~/.ssh/ #bash: cd: /c/Users/Administrator/.ssh/: No such ...

  4. GitHub使用笔记1:git客户端配置多ssh key

    公司用gitlab 外网的github同时配置 这样就导致我们要配置不同的ssh-key对应不同的环境. 具体操作步骤如下: 1:生成一个公司用的SSH-Key $ ssh-keygen -t rsa ...

  5. git配置多个ssh key

    随着工作的深入,我们通常都会有多个git账户.比如公司gitlab一个账户,github或gitee有一个账户.而平时我们又回通过 配置ssh公私钥认证的方式省去繁琐的登录远程仓库的操作,不同的git ...

  6. Git使用之设置SSH Key

    设置SSH Key 1.    检查是否已经有SSH Key. $cd ~/.ssh 如果说没有这个目录,就直接看第三步 2.    备份 3.    生成一个新的SSH. $ssh-keygen - ...

  7. git for windows配置SSH key

    0. 前言 之前用过一段时间的git,后来迁移系统导致电脑中的git bash消失了,由于在上家公司版本管理用的svn,所以一直没有重新配置,目前工作中版本管理用的gitLab,后期计划将工作之外的精 ...

  8. 使用git bush 生成github SSH公钥

    1 如果没有安装ssh,那么使用下面的指令 sudo apt-get install ssh 2 检查SSH公钥 cd ~/.ssh 看看存不存在.ssh,如果存在的话,掠过下一步:不存在的请看下一步 ...

  9. 利用Git生成本机SSH Key并添加到GitHub中

    本地仓库和github之间是通过SSH加密传输的,所以需要先到github中添加你本机的SSH Key 进行认证. 1.在桌面打开git命令窗口 2.输入“ssh-keygen -t rsa -C   ...

随机推荐

  1. http1.0 1.1 2.0区别

    http1.0 1.1 2.0区别 转载:https://blog.csdn.net/linsongbin1/article/details/54980801/ 1.HTTP1.0 1.1区别 (1) ...

  2. JavaScript学习总结(十二)——JavaScript编写类

    在工作中经常用到JavaScript,今天总结一下JavaScript编写类的几种写法以及这几种写法的优缺点,关于JavaScript编写类的方式,在网上看到很多,而且每个人的写法都不太一样,经常看到 ...

  3. spring boot 学习(八)定时任务 @Scheduled

    SpringBoot 定时任务 @Scheduled 前言 有时候,我们有这样的需求,需要在每天的某个固定时间或者每隔一段时间让应用去执行某一个任务.一般情况下,可以使用多线程来实现这个功能:在 Sp ...

  4. cas AssertionThreadLocalFilter

    AssertionThreadLocalFilter AssertionThreadLocalFilter作用很简单,就是将Assertion绑定到ThreadLocal. ThreadLocal 无 ...

  5. Automatic Login Using sshpass

    #! /bin/bash user=root password=12345678 remote_ip=192.168.3.140 sshpass -p $password ssh $user@$rem ...

  6. 自定义oncontextmenu

    <!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...

  7. Hibernate检索学习

    Hibernate的检索策略:类级别的检索策略:1对多,多对多的检索策略:多对一,一对一的检索策略 1.类级别的检索策略,可以通过class元素的lazy属性来设置,该设置只对load方法有效果 2. ...

  8. xml与json

    JSON(JavaScript Object Notation)是一种轻量级的数据交换格式. JSON现在基本上作为前后端数据交互的重要载体,在JSON之前,前后端主要的传输方式主要是通过XML或者文 ...

  9. [转]数据库更新(Update语句)查询

    2011-03-27 10:40:11| 分类: Database |举报|字号 订阅原文出自:http://blog.csdn.net/ylnjust02/archive/2005/12/10/54 ...

  10. Plotly绘图工具(多用于统计)

    作者:桂. 时间:2017-04-23  23:52:14 链接:http://www.cnblogs.com/xingshansi/p/6754769.html 前言 无意中考到一个小工具,网址为: ...