赞
踩
本文为《GitHub入门与实践》的读书笔记
以 Git 为代表
git
命令。如果勾选第一个选项则只能在 Git Bash 中运行 git
命令$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "your_email@example.com"
这个命令,会在 ~/.gitconfig
中以如下形式输出设置文件
[user]
name = Firstname Lastname
email = your_email@example.com
在 GitHub 上公开代码后,请不要使用汉字,尽量用英文进行描述
$ git config --global color.ui auto
~/.gitconfig
中会增加下面一行[color]
ui = auto
# ssh-keygen命令可以用来制作不用密码可立即登录的ssh用户
#
# 输入密码之后再用ssh连接服务器时就不需要再次输入密码了
$ ssh-keygen -t rsa -C "your_email@example.com" # your_email@example.com为创建账户时用的邮箱
Generating public/private rsa key pair.
Enter file in which to save the key(/Users/your_user_directory/.ssh/id_rsa): # 按回车键
Enter passphrase (empty for no passphrase): # 输入密码 也可以按回车不设置,这样在以后连接到服务器时就不用输入密码了
Enter same passphrase again: # 再次输入密码
id_rsa
文件是私有密钥,id_rsa.pub
是公开密钥Your identification has been saved in /Users/your_user_directory/.ssh/id_rsa.
Your public key has been saved in /Users/your_user_directory/.ssh/id_rsa.pub.
The key fingerprint is:
...# fingerprint值 your_email@example.com
The key's randomart image is:
+--[ RSA 2048]----+
| .+ + |
| = o O . |
# ...
SSH and GPG Keys
菜单。点击 New SSH Key
之后,会出现如下图所示的输入框。在 Title
中输入适当的密钥名称。Key
部分请粘贴 id_rsa.pub
文件里的内容$ cat ~/.ssh/id_rsa.pub
ssh-rsa 公开密钥的内容 your_email@example.com
# -T 选项表示不显示终端,只显示连接成功信息
$ ssh -T git@github.com
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is ... # fingerprint值 .
Are you sure you want to continue connecting (yes/no)? # 输入yes
Hi hirocastest! You've successfully authenticated, but GitHub does not provide shell access.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。