1、设置Git的user name和email:(如果是第一次的话)

  $ git config --global user.name "humingx"
$ git config --global user.email "humingx@yeah.net"

2、生成密钥

 $ ssh-keygen -t rsa -C "humingx@yeah.net"

连续3个回车。如果不需要密码的话。
最后得到了两个文件:id_rsaid_rsa.pub


如果不是第一次,就选择overwrite.

3、添加密钥到ssh-agent

确保 ssh-agent 是可用的。ssh-agent是一种控制用来保存公钥身份验证所使用的私钥的程序,其实ssh-agent就是一个密钥管理器,运行ssh-agent以后,使用ssh-add将私钥交给ssh-agent保管,其他程序需要身份验证的时候可以将验证申请交给ssh-agent来完成整个认证过程。

# start the ssh-agent in the background
eval "$(ssh-agent -s)"
Agent pid

添加生成的 SSH key 到 ssh-agent。

$ ssh-add ~/.ssh/id_rsa

4、登陆Github, 添加 ssh 。

id_rsa.pub文件里的内容复制到这里





5、测试:

$ ssh -T 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

 Hi humingx! You've successfully authenticated, but GitHub does not provide shell access.

如果看到Hi后面是你的用户名,就说明成功了。

6、修改.git文件夹下config中的url

修改前

[remote "origin"]
url = https://github.com/humingx/humingx.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*

修改后

[remote "origin"]
url = git@github.com:humingx/humingx.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*

7、发布

原文:

https://segmentfault.com/a/1190000002645623

git-ssh 配置和使用的更多相关文章

  1. git ssh配置

    SSH KEY的配置 生成 SSH KEY ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 文件在哪里生成的 C:\用户 ...

  2. git ssh 配置

    创建并切换到 ~/.ssh(存在就直接切换过去) 运行 ssh-keygen 创建 rsa 文件 复制 .pub 的文件内容,添加到网站的公钥列表 Git\etc\ssh\ssh_config 中添加 ...

  3. 小乌龟 git ssh配置问题解决, 没有的话执行pull push会没有权限,因为没有git的ssh

    ortoisegit 常见错误disconnected no supported authentication methods available(server sent: publickey) ht ...

  4. Git SSH公钥配置

    https://www.cnblogs.com/smuxiaolei/p/7484678.html https://blog.csdn.net/weixin_42063071/article/deta ...

  5. Git SSH密钥对生成以及多个SSH存在情况配置

    一.使用Git Bash 生成一个新的SSH密钥 1. 打开 Git Bash. 2. 邮箱设置粘贴下面的文字,替换成为你自己的邮箱. Github SSH 1 $ ssh-keygen -t rsa ...

  6. Git 下载、安装与SSH配置

    一.Git学习笔记(基于Github) Git简介 Git是目前流行的分布式版本管理系统.它拥有两套版本库,本地库和远程库,在不进行合并和删除之类的操作时这两套版本库互不影响.也因此其近乎所有的操作都 ...

  7. git ssh key配置&解决git每次输入密码

    git ssh key配置&解决git每次输入密码:https://blog.csdn.net/qq_42817227/article/details/81415404

  8. git ssh 22 端口不可用时通过https 443 端口配置git ssh

    Using SSH over the HTTPS port Sometimes, firewalls refuse to allow SSH connections entirely. If usin ...

  9. Git 进阶指南(git ssh keys / reset / rebase / alias / tag / submodule )

    在掌握了基础的 Git 使用 之后,可能会遇到一些常见的问题.以下是猫哥筛选总结的部分常见问题,分享给各位朋友,掌握了这些问题的中的要点之后,git 进阶也就完成了,它包含以下部分: 如何修改 ori ...

  10. git/ssh捋不清的几个问题

    主要是 windows 用户会遇到很多纠结的问题,linux/unix 用户属于这方面的高端用户,应该有能力处理此类问题,而且网络上也有很多解决方案,本文的授众是 windows 用户.由于今天配置了 ...

随机推荐

  1. 【Siverlight - 扩展篇】Silverlight在OOB模式下实现默认打开最大化

      在App.xaml.cs中输入以下代码:在OOB客户端打开,可以实现窗口默认最大化: private void Application_Startup(object sender, Startup ...

  2. WPF 简介

    简介 一.   WPF产生的背景 因为人们的生活水平不断提前,审美观也随着提升,而软件的应用发展水平目前无法赶上大家的审美观和使用要求:比如:像电影中的软件能够方便的使用,而且有动态的效果同时附加形象 ...

  3. 转】mysql数据库delete数据时不支持表别名

    原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4012853.html 感谢! 今天在帮同事查看一条删除的SQL语句执行出错的问题 SQL语句如下: 1 DELE ...

  4. Python 代码性能优化技巧(转)

    原文:Python 代码性能优化技巧 Python 代码优化常见技巧 代码优化能够让程序运行更快,它是在不改变程序运行结果的情况下使得程序的运行效率更高,根据 80/20 原则,实现程序的重构.优化. ...

  5. <转>Linux环境进程间通信(二): 信号(下)

    原文地址为:http://www.ibm.com/developerworks/cn/linux/l-ipc/part2/index2.html 原文为: 一.信号生命周期 从信号发送到信号处理函数的 ...

  6. Controlling GameObjects Using Components

    [Accessing Components] The most common case is where a script needs access to other Components attac ...

  7. codeforces 659A Round House

    A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  8. [转载]关于AutoCAD.NET的辅助方法

    转载自:http://www.cnblogs.com/milian/p/3315000.html 求中点坐标: /// <summary> /// 中点 /// </summary& ...

  9. svn如何回滚到之前版本

    第一种情况:改动没有被提交(commit). 这种情况下,使用svn revert就能取消之前的修改. svn revert用法如下: # svn revert [-R] something 其中so ...

  10. easyui反选全选和全不选代码以及方法的使用

    首先要说明的是,onclick="javascript:这里能写方法的名字,也能写一段JS的代码,但是方法名字要带括号.",其次就是onclick=“这里写的方法名必须存在于本页面 ...