Win7下生成SSH Key连接Github--(MsysGit)

ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist

We strongly recommend using an SSH connection when interacting with GitHub. SSH keys are a way to identify trusted computers, without involving passwords. The steps below will walk you through generating an SSH key and then adding the public key to your GitHub
account.

Tip: We recommend that you regularly review
your SSH keys list
 and revoke any that haven‘t been used in a while.

Step
1: Check for SSH keys

First, we need to check for existing SSH keys on your computer.Open up your
Git Bash and type:

ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist

Check the directory listing to see if you have files named either id_rsa.pub orid_dsa.pub.
If you don‘t have either of those files, go to step
2. Otherwise, skip to step
3.

Step
2: Generate a new SSH key

To generate a new SSH key, copy and paste the text below, making sure to substitute in your email address. The default settings are preferred, so when you‘re prompted to "Enter a file in which to save the key", just press Enter to
continue.

ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]

Next, you‘ll be asked to enter a passphrase.

Tip: We strongly recommend a very good, secure passphrase. For more information,
see Working
with SSH key passphrases
.

# 

Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

Which should give you something like this:

# 
Your identification has been saved in /c/Users/you/.ssh/id_rsa.
# Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]

Then add your new key to the ssh-agent:

# start the ssh-agent in the background
eval "$(ssh-agent -s)"
# Agent pid 59566
ssh-add ~/.ssh/id_rsa

Step 3: Add your SSH key to GitHub

Run the following code to copy the key to your clipboard.

clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
Alternatively, using your favorite text editor, you can open the ~/.ssh/id_rsa.pub file and copy the contents of the file manually
Now that you have the key copied, it‘s time to add it into GitHub:
  1. In
    the user bar in the top-right corner of any page, click Account
    settings
    .
  2. Click SSH
    Keys
     in the left sidebar.
  3. Click Add
    SSH key.
  4. In the Title field, add a descriptive label for the new key. For example, if you‘re using a personal Mac, you might call this key "Personal MacBook Air".
  5. Paste
    your key into the "Key" field.
  6. Click Add
    key.
  7. Confirm the action by entering your GitHub password.

Step
4: Test everything out

To make sure everything is working, you‘ll now try SSHing to GitHub. When you do this, you will be asked to authenticate this action using your password, which was the passphrase you created earlier.

Open up your Git
Bash and type:

ssh -T [email protected]
# Attempts to ssh to github

You may see this warning:

The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?

Don‘t worry! This is supposed to happen. Verify that the fingerprint in your terminal matches the one we‘ve provided up above, and then type "yes."

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

If that username is yours, you‘ve successfully set up your SSH key! Don‘t worry about the "shell access" thing, you don‘t want that anyway.

If you receive a message about "access denied," you can read
these instructions for diagnosing the issue
.

If you‘re switching from HTTPS to SSH, you‘ll now need to update your remote repository URLs. For more information, see Changing
a remote‘s URL
.

Win7下生成SSH Key连接Github--(MsysGit)

时间: 2024-08-29 00:22:56

Win7下生成SSH Key连接Github--(MsysGit)的相关文章

windows 下生成 ssh key

这个问题是学习git 的时候遇到的. 先介绍一下什么是ssh key 你有github 账号,需要往上面推送文件,他需要识别推送文件的这个人是你,也就用到了ssh key 了. 本地安装git 生成ssh key 的时候,id_rsa.pub 是公钥文件,任何人都可以看,就是把它粘贴到github上. github 添加ssh key 的路径是 setting ---> SSH key and GPK key 好了,下面说一下具体的操作步骤. 1 查看本地是否已有 SSH keys 查看当前用户

MAC如何生成SSH key与GitHub关联

一.检查 SSH key 是否存在 在终端输入如下代码: ls -al ~/.ssh 如果没有,终端显示如下: No such file or directory 如果有,终端显示如下: ? ~ ls -al ~/.ssh total 24 drwx------ 5 ant staff 160 1 11 11:12 . drwxr-xr-x+ 91 ant staff 2912 1 11 11:32 .. -rw------- 1 ant staff 1675 1 11 11:09 id_rsa

创建SSH Key连接github或gitlab

当我们从github或者gitlab上clone项目或者参与项目时,我们需要证明我们的身份.一种可能的解决方法是我们在每次访问的时候都带上账户名.密码,另外一种办法是在本地保存一个唯一key,在你的账户中也保存一份该key,在你访问时带上你的key即可.github.gitlab就是采用key来验证你的身份的,并且利用RSA算法来生成这个密钥. 链接方法 首先你需要在github上或者gitlab上有一个自己的账户 打开git bash,输入命令ls -al ~/.ssh.检查是否显示有id_r

Windows下设置 ssh key,配置GitHub ssh key

1.新建一个目录,利用git工具打开 Git Bash Here 2.执行如下命令 ssh-keygen -t rsa -C "[email protected]" 其中邮箱为GitHub的邮箱 3.再执行eval  "ssh-agent -s"命令 4.输入ssh-add ~/.ssh/id_rsa 命令时候报错 5.出现上述情况,输入ssh-add ~/.ssh/id_rsa 后,再次执行ssh-add ~/.ssh/id_rsa 后成功 6. 用vim复制ke

使用SSH密钥连接Github

使用Github,也许大家觉得比较麻烦的就是在每次push的时候,都需要输入用户名和密码.如果使用SSH,就可以记住用户名,并创建属于自己的密码来保证安全操作,还有神奇的一招可以“不用输入密码”哦.下面将介绍如何创建SSH Keys并将公钥加到GitHub账户中,使用SSH Keys在本机和GitHub之间建立一个安全的连接. 一.Windows环境下生成SSH key且连接GitHub 第一步.看看是否存在SSH密钥(keys) 首先,我们需要看看是否看看本机是否存在SSH keys,打开Gi

git 生成ssh key gitlab 增加 ssh key

1.在用户目录下生成 ssh key $ cd ~/.ssh 查看密钥 $ ls config (配置git 地址端口) { host:   port: } id_dsa (密钥)  id_dsa.pub (公钥) $ ssh-keygen 生成密钥 2.将密钥保存到gitlab 在github上点击"setting", 找到添加SSH key的菜单,然后新增SSH key: 把文件id_rsa.pub  里面的内容全部复制到 key编辑框中, 保存完毕:

多机使用SSH key连接至Github Page

在本地机器中安装好Git和Hexo之后,在终端或是Git Bash中执行如下代码: 12 git config --global user.name "YOUR NAME" # Github注册账户名git config --global user.email "YOUR EMAIL ADDRESS" # Github注册邮箱 验证Github 输入以下命令,生成SSH key: 1 ssh-keygen -t rsa -b 4096 -C "YOUR E

win7下用SSH连接linux虚拟机

本文来自转载:原文 [需求] 在win7环境下用SSH(SecureShell)连接本地的一台虚拟机上ubuntu(11.10)系统 [环境] win7,ubuntu,vmware(8.0) [方案] 首先要确定ubuntu上安装并且启动了ssh服务,然后还要确保linux系统上的防火墙要关闭,win7的防火墙可以正常开启 SSH可以google下载的了. 步骤: 1, 有人说首先要在Virtual Network Editor做NAT 的端口映射,其实是不需要的; ps -e|grep ssh

使用 ssh key 验证 github

使用ssh key验证github的好处就是不用每次提交代码的时候都要输入用户名和密码,因为着在一定程度上对效率有很大的影响,虽然这么做可以防止代码提交的次数过多,但这也看个人的习惯吧. 今天尝试了一下配置ssh key OS:mac os 打开控制台,建一个目录,比如~/.ssh(其实叫什么都无所谓,网上搜的基本上都这么配置) 在该目录下输入命令: ssh-keygen -t rsa -C "[email protected]" 注意:双引号换成自己的邮箱,如果遇到权限问题,只需在前