github配置密钥SSH keys

2017-10-10  本文已影响21人  Jannonx

当你github创建了一个仓库后,关联本地文件,可能出现以下情况:

$ git commit -m "init page"
[master (root-commit) d832761] init page
 1 file changed, 7 insertions(+)
 create mode 100644 index.html
$ git remote add origin git@github.com:xxxxx/xxxxx.github.io.git
$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ ssh-keygen -t rsa -C 你的邮箱地址
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
2c:03:89:09:5c:4c:2a:b9:2b:bd:ec:2b:a0:ce:ff:22 791273579@qq.com
The key's randomart image is:
+--[ RSA 2048]----+
|o +o             |
| +.+ .           |
|o.o o            |
|..   . .         |
|.     o S        |
|.o     o         |
|= .              |
|=E o             |
|.=Boo.           |
+-----------------+
$ git push -u origin master
Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 293 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:xxxxx/xxxxx.github.io.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
上一篇 下一篇

猜你喜欢

热点阅读