[スイッチ] SSHキーを生成する方法

今後の参考のためにそれをマーク

この記事は、中に含まれているGevinのブログ
オリジナル住所:http://blog.igevin.info/posts/generate-ssh-key-for-git/

SSHキーGitHubには、このように、と通信するための方法を提供し、それはパスワードを入力しなくても可能であるが、彼らのGitHubのサーバなどのリモートエンド、バージョン管理

ステップ

  • SSHキーが存在するかどうかをチェックします
  • 新しいSSHキーを生成します
  • GitHubのにSSHキーを追加します。
SSH鍵を生成する方法
SSH鍵を生成する方法

SSHキーがあるかどうかをチェックします

そこにファイルがある場合、次のコマンドを入力するid_rsa.pubか、id_dsa.pub第二工程にGitHubのSSHキーにステップ3に直接添加され、そうでなければ発生SSH鍵

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

2.新しいSSHキーを作成します。

最初のステップ:公開/秘密RSA鍵ペアを生成する
コマンドラインでssh-keygen -t rsa -C "[email protected]"

デフォルト(/ your_home_path)各パスで発生id_rsaし、id_rsa.pub次のコードに示すように、2つのファイル

ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key using the provided email
Generating public/private rsa key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_rsa):

ステップ2:パスフレーズを入力します(このステップはスキップすることができます)

パスフレーズ、バージョンコントロールを設定し、それぞれが特定の「ミス」を防ぐために、パスフレーズGitHubの通信を入力するように求められます後

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

サンプルの結果:

Your identification has been saved in /your_home_path/.ssh/id_rsa.
Your public key has been saved in /your_home_path/.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]

第三段階:SSHエージェントに新たに生成されたキーを追加します。

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

3. GitHubのにSSHキーを追加します。

開くためにあなたの好きなテキストエディタを使用してid_rsa.pubのGitHubにこの情報をコピーし、内部の情報は、SSHキーで、ファイルをAdd SSH keyするページ

異なるオペレーティングシステムは、次のようにSSHキーファイルは、クリップボードにコピーされているから直接いくつかのコマンドがあります。

マック

pbcopy < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

ウィンドウズ

clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

Linuxの

sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)

xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

最初に含まれているこの記事Gevinさんのブログ



著者:Gevinは
//www.jianshu.com/p/31cbbbc5f9fa:リンク:httpsの
出典:ジェーン・ブック
著者によって予約ジェーンブックの著作権は、いかなる形で再現され、承認を得るために、作者に連絡して、ソースを明記してください。

 

おすすめ

転載: www.cnblogs.com/Arborday/p/11263517.html