git添加远程仓库
来源:互联网 发布:标点符号检查软件 编辑:程序博客网 时间:2024/04/30 13:00
首先确保你已经安装了git ,否则下面的就不要看了,先去安装git吧。
一、检查SSH key
ssh key是一种确定能相信的计算机的方法,而且不涉及密码。
首先要检查一下你的电脑上是否已经存在ssh key,打开git bash输入:
ls -al ~/.ssh
检查这个目录看是否已经有一个公开的ssh key,它的默认的文件名如下:id_dsa.pub、id_rsa.pub
如果你已经有了一个公有的和私有的密钥,那你可以直接跳过第二步和第三步。
二、创建ssh key
首先,你要在github上注册一个账号。然后在git bash里输入:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"# Creates a new ssh key, using the provided email as a label# Generating public/private rsa key pair.然后,你可能遇到下面的提示,笔者建议保持默认,直接enter。
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]接着,你被要求输入一个密码:
Enter passphrase (empty for no passphrase): [Type a passphrase]# Enter same passphrase again: [Type passphrase again]
输入密码后,你将得到如下提示:
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看到这,你的ssh key就创建完成了。
三、添加ssh key到ssh代理里
要配置的ssh-agent程序使用您的SSH密钥。在git bash里输入:
# start the ssh-agent in the backgroundssh-agent -s# Agent pid 59566添加ssh key 到ssh-agent.
ssh-add ~/.ssh/id_rsa
四、添加ssh key到你的账户
登陆你的github,点击settings,然后点击ssh keys,点击add ssh key,把你的后缀为.pub的公开密钥粘贴到里面,
然后点击add key
五、测试连接
五、测试连接
打开git bash输入:
ssh -T git@github.com# Attempts to ssh to GitHub你会看到如下信息:
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)?
输入yes后会看到:
Hi username! You've successfully authenticated, but GitHub does not# provide shell access.如果用户名是你的,则恭喜你,连接成功。
六、添加远程库
1、在github上创建一个版本库,test。
2、在本地创建一个版本库,test。
3、打开git bash输入:
$ git remote add origin git@github.com:账户名/test.git用户名改成你的github用户名。这样就可以把本地库与远程库关联起来。
git push -u origin master输入上面的代码可以把本地的内容上传到github上。
git clone git@github.com:用户名/test.git输入上面一行代码可以把远程库的内容克隆到本地。
0 0
- git - 添加远程仓库
- git添加远程仓库
- git添加远程仓库
- Git添加远程仓库
- 添加Git 远程仓库
- Git添加到远程仓库
- 九、Git-添加远程仓库
- git添加/删除远程仓库
- 【转】git添加远程仓库,很详细
- 3.Git远程仓库添加及克隆
- Git远程仓库的添加及克隆
- Git入门(10)-添加远程仓库
- git创建分支添加远程仓库上传
- GIT 远程仓库:添加远程库、从远程库克隆
- GIT部署(三)GIT 远程仓库:添加远程库、从远程库克隆
- Git实现从本地添加项目到远程仓库
- Git学习笔记(六)---添加远程仓库
- Git实现从本地添加项目到远程仓库
- POJ 2242 The Circumference of the Circle 简单数学
- CentOS用户切换
- Android 自定义日历控件
- WordPress学习笔记(二):wordpress如何做到在子目录安装而在根目录访问
- 很不幸,今天感冒了......
- git添加远程仓库
- shell计算日期之间的天数
- UIScrollView
- UIScrollview AutoLayout
- Java中的反射和注解
- RF随机森林
- android timessquare日期控件
- UVA 796 Critical Links
- *(volatile unsigned long *) 语法