Chinaunix首页 | 论坛 | 博客
  • 博客访问: 210259
  • 博文数量: 145
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 1720
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-14 18:42
文章分类

全部博文(145)

文章存档

2011年(1)

2009年(144)

我的朋友

分类: LINUX

2009-08-27 16:36:56

by tangke 2009-08-27

本文主要讲解我在github注册的第一个项目,以及以后如何进行维护

1.首先生成一个ssh public key
$ssh-keygen
将会在~/.ssh/生成如下两个文件id_rsa  id_rsa.pub

2.在github网站上面注册一个account,然后将id_rsa.pub中的内容添加进去。

3.然后在通过我的account建议一个项目desktop_loongson.

项目地址
git://github.com/mumutou/desktop_loongson.git

4.在本地机器上面建立一个git repos
$cd desktop_loongson
$git init
$git add ./
$git commit -a -m "init repos"
建立一个远程别名
$git remote add origin git@github.com:mumutou/desktop_loongson.git
将这个repos添加到远程服务器上面并作为master分支
$git push orgin master

但是发现如下问题
The authenticity of host 'github.com (65.74.177.129)' 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)? yes
Warning: Permanently added 'github.com,65.74.177.129' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

看了一下网上的帮助,github确实有这个问题,可能过两天莫名其妙又好了。

现在在网上看到一篇文章可以解决github的publickey问题,本人已经验证过,OK
Linux
Step 1: Check to see if you already have a public/private key pair for your user.
If you do, it will be in your ~/.ssh directory.

[~]$ cd .ssh
[~/.ssh]$ ls
config                id_dsa.pub
id_dsa                known_hosts

Key pairs are always named like something and something.pub. The something file is your private key and must be kept secret. The something.pub file is your public key, and this is what you’ll be giving us. If you already have a key pair (in the above listing I have an id_dsa key pair) and you want to use it for GitHub, then skip to Step 3.
Step 2: Generate a public/private dsa key pair if you don’t already have one.

This is done with the ssh-keygen program:

[~/.ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/tom/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tom/.ssh/id_dsa.
Your public key has been saved in /home/tom/.ssh/id_dsa.pub.
The key fingerprint is:

The passphrase that you enter will be requested from you every time you push or pull from a private repository. You can use ssh-agent to automate password entry, or you can simply hit enter to not use a passphrase.
Step 3: Upload your public key to GitHub.

Copy your public key to the clipboard so you can easily paste it into your web browser. If you have xclip installed then:

[~/.ssh]$ cat id_dsa.pub | xclip

The xclip command copies whatever is sent to it via STDIN to the clipboard (you may have to use xclip -selection clipboard), ensuring that you won’t have any extraneous newlines or other problems. Now you can simply select the appropriate text entry box in GitHub and paste in your public key! If you don’t have xclip then either install it using your OS’s package manager or print out the public key to a terminal so that you can manually copy the key data.

[~/.ssh]$ cat id_dsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1FlHRbbxXIv/hLDTeJczlEqGNt0oFcoPEEENHThzP5ku
PDsitSSUH2MATP014G/3BzaI9pdnhf02MSEcmtmIKXrm05/dzxEmp9yOY32YHyk6/rLUGGTJuWOpGt3J
6H5LWxq9yeRUuFG/pCRH3+KxOyzasSHXfXJaC5v7wPxUdAeg9k0jwsUjnqUcYvzo5+GwCXV9dIwY3Sr/
OrL2l8SCdSWyd3PLufJXKQHlouHB0NI/+G/QjWmkB8c1PJh/VuIe36mqv82V9XXKvYNaVWwz5Sg6aY9u
p2lgDEme+AFdPPjOnkdF6OHCr7ymKg6c/B2YCbOW7QN/L4uAdVOhTNnJMQ== tom@volcano

Copy the entirety of the public key to the clipboard. It is important that there are no newlines in the key (copying from the cat output in your console should work properly. Now you can simply select the appropriate text entry box in your GitHub account and paste in your public key!

参考文章:


阅读(718) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~