解决github下创建一个项目版本库遇到的权限问题
首先在github上注册一个账号,创建一个“自定义名称”的版本库
创建完成之后,github会提供一个简易的操作指南
Global setup: Set up git git config --global user.name "user_name" git config --global user.email ×××@×××.com Add your public key Next steps: mkdir project_name cd project_name git init touch README git add README git commit -m 'first commit' git remote add origin git@github.com:user_name/project_name.git git push -u origin master Existing Git Repo? cd existing_git_repo git remote add origin git@github.com:user_name/project_name.git git push -u origin master Importing a Subversion Repo? Click here When you're done: Continue
“Permission denied (publickey).fatal: The remote end hung up unexpectedly”
$ cd ~/.ssh
$ ls# 显示来当前目录下的所有子目录# configid_rsaid_rsa.pubknown_hosts$ mkdir key_backup# 在当前目录下创建一个叫做"key_backup"的子目录$ cp id_rsa* key_backup# 备份以前的key文件到上面新建的文件夹中$ rm id_rsa*# 删除旧的key文件
$ ssh-keygen -t rsa -C "your_email@youremail.com"# 使用一个私人的email地址,来生成一个ssh key# 生成 公开/私有 的一对key(Generating public/private rsa key pair.)# 输入要保存key文件的目录(enter键 使用括弧里面的默认设置)(/Users/your_user_directory/.ssh/id_rsa):<press enter># 然后输入一个密码(passphrases)Enter passphrase (empty for no passphrase):<enter a passphrase>Enter same passphrase again:<enter passphrase again>
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:01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db user_name@username.comThe key's randomart image is:+--[ RSA 2032]----+| .+ + || ssssssss || = * * || o = + || ssss . || o oss || o .sE || || |+-----------------+
$ ssh -T git@github.comAttempts to ssh to githubWhich should give you this:The authenticity of host 'github.com (207.97.227.239)' 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)?Don’t worry, this is supposed to happen. Type “yes”.Hi username! You've successfully authenticated, but GitHub does not provide shell access.Having problems?