Github使用总结(添加ssh-key,新建仓库,添加协作者) 转
http://jingyan.baidu.com/article/ab0b5630936ab6c15afa7d1c.html
https://help.github.com/articles/generating-ssh-keys/
今天为了把项目挂到Github上并且和组员协作好,研究了下Github的使用方法,现在做个总结记录下来。
1.添加ssh-key(该部分转自Github官网https://help.github.com/articles/generating-ssh-keys)
Step 1: Check for SSH keys
Have an existing keypair you'd like to use? You can skip to Step 4.
First, we need to check for existing ssh keys on your computer. Open up Terminal and run:
cd ~/.ssh# Checks to see if there is a directory named ".ssh" in your user directory
If it says "No such file or directory" skip to step 3. Otherwise continue to step 2.
Step 2: Backup and remove existing SSH keys
Since there is already an SSH directory you'll want to back the old one up and remove it:
ls# Lists all the subdirectories in the current directory
# config id_rsa id_rsa.pub known_hosts mkdir key_backup# Makes a subdirectory called "key_backup" in the current directory cp id_rsa* key_backup# Copies the id_rsa keypair into key_backup rm id_rsa*# Deletes the id_rsa keypair
Step 3: Generate a new SSH key
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
ssh-keygen -t rsa -C "your_email@example.com"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
Now you need to enter a passphrase.
# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
Which should give you something like this:
# Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
Step 4: Add your SSH key to GitHub
Run the following code to copy the key to your clipboard.
pbcopy < ~/.ssh/id_rsa.pub# Copies the contents of the id_rsa.pub file to your clipboard
Be warned: it is important to copy the key exactly without adding newlines or whitespace. Thankfully the
pbcopycommand makes it easy to perform this setup perfectly.
Go to your Account Settings
Click "SSH Keys" in the left sidebar
Click "Add SSH key"
Paste your key into the "Key" field
Click "Add key"- Confirm the action by entering your GitHub password
Step 5: Test everything out
To make sure everything is working you'll now SSH to GitHub. When you do this, you will be asked to authenticate this action using your password, which for this purpose is the passphrase you created earlier. Don't change the git@github.com part. That's supposed to be there.
ssh -T git@github.com# Attempts to ssh to github
You may see this warning:
# 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. Verify that the fingerprint matches the one here and type "yes".
# Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
If that username is correct, you've successfully set up your SSH key. Don't worry about the shell access thing, you don't want that anyway.
If you see "access denied" please consider using HTTPS instead of SSH. If you need SSH start atthese instructions for diagnosing the issue.
2.新建仓库
2.1 在Github上登陆自己的账号点击右上方的Create New Repo

2.2 填写好自己的仓库名,(例如CSDNTest)

2.3Github上新建好仓库后在命令行运行如下指令(学过Git的应该知道是什么意思)
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:chenyl107/CSDNTest.git
git push -u origin master
3.添加协作者
你的仓库-->setting-->Collaborators,然后输入你的协作者的用户名 add就可以了

Github使用总结(添加ssh-key,新建仓库,添加协作者) 转的更多相关文章
- 为github添加ssh key
用git关联github上的远程仓库前需要先为github添加ssh key 一.检查本机是否生成ssh key 本地查找.ssh文件,其中id_rsa.pub中的内容就是ssh key 二.为git ...
- windows系统如何添加ssh key到github
我自己的电脑安装了git后,从来没有用过,今天偶然用了一次,发现不能pull到东西,报错说我没有权限,于是我网上搜索了一下,应该是我没有配置ssh key的原因,相信很多人都有和我一样的经历吧,这里呢 ...
- github 添加 SSH key
在 github 上添加 SSH key 的步骤: 1.首先需要检查你电脑是否已经有 SSH key 运行 git Bash 客户端,输入如下代码: $ cd ~/.ssh $ ls 这两个命令就是检 ...
- github添加ssh key报错Key is invalid. Ensure you've copied the file correctly
github添加ssh key的时候报错:Key is invalid. Ensure you've copied the file correctly 将秘钥复制粘贴到文本编辑器中,再粘贴复制到
- github添加SSH Key
1.背景介绍 缘由:在github上下载goagent时出现错误. 在终端使用命令:git clone git@github.com:phuslu/goagent.git 会报权限错误如下: Clon ...
- (诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)
在为windows 环境下的github账户添加SSH key时,需要在Git Bash执行如下命令: 第一步:检查已有的SSH keys $ ls -al ~/.ssh 第二步:生成新的SSH ke ...
- github入门:设置添加ssh key<转>
GitHub是个分布式的版本控制库.github通过git使用,可以方便的记录代码版本. 通过github可以学习优秀的代码,可以改进提交其他项目中的bug,借助社区力量促进软件优化完善. 国内外大量 ...
- git生成ssh key步骤并添加到github网站
0: 查看是否已经有了ssh密钥 执行命令:cd ~/.ssh 如果没有密钥则不会有此文件夹,有则备份删除 1:使用 Git Bash生成新的ssh key ssh-keygen -t rsa -C ...
- 如何给 GitHub 添加 SSH key, 如何生成 SSH key 详细图文教程!
如何给 GitHub 添加 SSH key, 如何生成 SSH key 详细图文教程! 一. 生成 SSH key https://ide.c9.io/xgqfrms/ 创建一个空项目:(或使用 ...
- 多github帐号的SSH key切换
我有两个github帐号,一个是个人所用,一个是为公司项目所用.如果是单用户(single-user),很方便,默认拿id_rsa与你的github服务器的公钥对比:如果是多用户(multi-user ...
随机推荐
- vscode解决nuget插件不能使用的问题
错误提示 使用vscode安装nuget插件之后出现错误: "Versioning information could not be retrieved from the NuGet pac ...
- Elasticsearch核心技术与实战-简介
讲师阮一鸣介绍ebay的Pronto团队在ebay内部管理上百个Elasticsearch集群,超过4000个数据节点.在生产环境上支持的服务有 订单搜索.商品推荐.日志管理.风险控制.IT运维.安全 ...
- CSS学习笔记-动画模块
动画模块: 1.过渡和动画之间的异同 1.1不同点 (1)过渡必须人为触发才能执行 (2)动画不需要人为触发就可以执行 1 ...
- iOS关于制作动画运动轨迹(UIBezierPath介绍)
参考链接: https://www.jianshu.com/p/6c9aa9c5dd68
- python中基本数据类型以及运算符
python中基本数据类型以及运算符的知识 一.与用户的交互以及python2与python的区别 1.1什么是与用户交互 用户交互就是人往计算机中input(输入数据),计算机print(输出结果) ...
- sqlserver取字符串拼音首字母
sqlserver 使用函数获取一个字符串的拼音首字母 create function dbo.fn_getpinyin ( @str nvarchar(max) ) returns nvarchar ...
- linux shell脚本相关知识
最近的项目中,有一个编写linux shell脚本的任务.由于之前不是很熟悉,在这个过程中遇到了很多困难,查找了很多资料,也收获了很多.下面是linux shell脚本中常用的知识总结. 1基础语法 ...
- jango rest-framework page_size更新
老项目是三年前写的, 这周的新项目要用上DRF的分页功能时,发现老的写法无效了. 于是看了一些文档,原来写法变了. https://blog.csdn.net/dqchouyang/article/d ...
- nginx学习(二):nginx显示默认首页解析过程
本篇文章分析下nginx 显示默认首页的过程 如下图所示 查看config文件: # 如果忘记nginx 安装目录.使用下面命令查看 [root@XXX]# whereis nginx nginx: ...
- #undef常用法
Copy from C语言中#undef的语法是: #undef 标识符 用来将前面定义的宏标识符取消定义. 整理了如下几种常见用法,如果以后发现其他的再添加进来. 1.在一个程序块中用完宏定义后,为 ...