Skip to content

Commit 0bb33dd

Browse files
committed
xsel is pbcopy/pbpaste for Linux.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
1 parent 57c36e9 commit 0bb33dd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

02-join-github/010-account-setup.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ GitHub的SSH服务支持OpenSSH格式的公钥认证,可以通过Linux、Mac O
146146
IdentityFile ~/.ssh/gotgithub
147147

148148
好了,有了上面的准备,就将\ :file:`~/.ssh/gotgithub.pub`\ 文件内容拷贝到剪切板。\
149-
在命令行用下面的命令可直接将文件内容拷贝到剪切板:
149+
公钥是一行长长的字符串,若用编辑器打开公钥文件会折行显示,注意拷贝时切莫在其中\
150+
插入多余的换行符、空格等,否则在公钥认证过程因为服务器端和客户端公钥不匹配而\
151+
导致认证失败。命令行下可直接用\ ``pbcopy``\ 命令\ [#]_\ 将文件内容拷贝到剪切板\
152+
以避免拷贝错误:
150153

151154
::
152155

153156
$ cat ~/.ssh/gotgithub.pub | pbcopy
154157

155158

156159
然后将公钥文件中的内容粘贴到GitHub的SSH公钥管理的对话框中,如图2-8所示。\
157-
注意要忠实地拷贝公钥的内容,切莫在其中插入多余的换行符、空格而导致认证失败。
158160

159161
.. figure:: /images/join-github/setting-ssh-gotgithub.png
160162
:scale: 100
@@ -196,4 +198,14 @@ GitHub的SSH服务支持OpenSSH格式的公钥认证,可以通过Linux、Mac O
196198

197199
.. _gravatar.com: http://gravatar.com/
198200

201+
----
202+
199203
.. [#] https://github.com/blog/1007-skinny-header
204+
.. [#] Mac下的命令行工具\ ``pbcopy``\ \ ``pbpaste``\ 可以在命令行下操作剪贴板,\
205+
Linux下的命令行工具\ ``xsel``\ 亦可实现类似功能。在Linux下可以创建别名用\
206+
``xsel``\ 命令来模拟\ ``pbcopy``\ \ ``pbpaste`` \。
207+
208+
::
209+
210+
alias pbcopy='xsel --input'
211+
alias pbpaste='xsel --output'

0 commit comments

Comments
 (0)