澳门正规赌博十大网站-澳门游戏网站
做最好的网站

github工程的本地建立和远程仓库同步,简单记录

付出情况:ubuntu 

1.添加SSH Key:
[html] 
ssh-keygen -t rsa -C "邮件地址" 

什么样生成SSH key

SSH key提供了一种与GitHub通讯的措施,通过这种办法,能够在不输入密码的情景下,将GitHub作为友好的remote端服务器,实行版本调控

  1. 检查SSH keys是或不是存在

  2. 转变新的ssh key

  3. 将ssh key添加到GitHub中

什么生成SSH KEY

  1. 自己切磋SSH keys是或不是留存

输入上面包车型地铁吩咐,假如有文件id_rsa.pub 或 id_dsa.pub,则直接进入步骤3将SSH key增加到GitHub中,不然进入第二步生成SSH key

ls -al ~/.ssh

# Lists the files in your .ssh directory, if they exist

  1. 变迁新的ssh key

github工程的本地建立和远程仓库同步,简单记录。第一步:生成public/private rsa key pair

在命令行中输入ssh-keygen -t rsa -C "your_email@example.com"

暗许会在对应路线下(/your_home_path)生成id_rsa和id_rsa.pub两个文件,如上面代码所示

github工程的本地建立和远程仓库同步,简单记录。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 (/your_home_github工程的本地建立和远程仓库同步,简单记录。path/.ssh/id_github工程的本地建立和远程仓库同步,简单记录。rsa):

第二步:输入passphrase(本步骤能够跳过)

设置passphrase后,举办版本调节时,每趟与GitHub通讯都会须要输入passphrase,以幸免有个别“失误”

Enter passphrase (empty for no passphrase): [Type a passphrase]

Enter same passphrase again: [Type passphrase again]

sample result:

Your identification has been saved in /your_home_path/.ssh/id_rsa.

Your public key has been saved in /your_home_path/.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

其三步:将新生成的key加多到ssh-agent中:

# start the ssh-agent in the background

eval "$(ssh-agent -s)"

Agent pid 59566

github工程的本地建立和远程仓库同步,简单记录。ssh-add ~/.ssh/id_rsa

  1. 将ssh key添加到GitHub中

用本身喜欢的文件编辑器展开id_rsa.pub文件,里面包车型地铁音信即为SSH key,将这一个消息复制到GitHub的Add SSH key页面就可以

不同的操作系统,均有一对发令,直接将SSH key从文件拷贝到粘贴板中,如下:(注目的在于粘贴的时候,必要在github对应项目下的setting中挑选deploy key然后粘贴完毕后勾选提供写权限的操作就可以,否则前边使用key提交工程的时候会报权限错误,那点一定要铭记)

mac

pbcopy < ~/.ssh/id_rsa.pub

# Copies the contents of the id_rsa.pub file to your clipboard

windows

clip < ~/.ssh/id_rsa.pub

# Copies the contents of the id_rsa.pub file to your clipboard

linux

sudo apt-get install xclip

# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)

xclip -sel clip < ~/.ssh/id_rsa.pub

# Copies the contents of the id_rsa.pub file to your clipboard

 

输入指令之后就回车,会油但是生以下提示,回车
[html] 
Enter file in which to save the key (/home/lqg/.ssh/id_rsa):  

地面git版本饭馆的成立

cd 本地代码货仓路线

git init

git add *

git commit -m "first commit"

1.添加SSH Key:

跟着提示输入解密钥的加密串:
[html] 
Enter passphrase (empty for no passphrase):  
Enter same passphrase again:  

远程旅馆的链接和代码提交

git remote add origin git@github.com:username/xxx.git (注意这里是ssh类型的git货仓地址,不是选项的https类型的)

git push -u origin master

[html] view plaincopy

输入后有以下提示为成功:
[html] 
Your identification has been saved in /home/lqg/.ssh/id_rsa. 
Your public key has been saved in /home/lqg/.ssh/id_rsa.pub. 
The key fingerprint is: 
91:0f:4e:ec:89:ad:3b:75:d1:32:a9:f1:59:ee:8f:
The key's randomart image is: 
--[ RSA 2048]----  
|                 | 
|       . .       | 
|        *  o     | 
|       *.== o    | 
|      . S .B     | 
|       .o .    | 
|      .. . .     | 
|      ..    .o . | 
|      ..    ..E  | 
-----------------  
紧接着,vim ~/.ssh/id_rsa.pub,复制全体内容,
说起底转到github页面,在account setting里面选用ssh key - add key ,把后边复制的内容粘帖,保存。。。
敲句发号施令测验下:
[html] 
ssh -T [email protected]

ssh key出现错误的化解办法

科学普及的主题素材比如: 

The key you are authenticating with has been marked as read only

化解办法:平时因为中期创造ssh key的时候从不勾选写权限的操作而招致的

key is already in use

消除办法: 几个货仓同期利用了ssh key,能够经过删除ssh key重新创立的格局来修改

ssh-add -D

rm -r ~/.ssh

删去你在github中的public-key

双重生成ssh密钥对

ssh-keygen -t rsa -C "xxx@xxx.com"

chmod 0700 ~/.ssh

chmod 0600 ~/.ssh/id_rsa*

接下去平常操作

在github上增添公钥public-key:

1、首先在你的顶点运维 xclip -sel c ~/.ssh/id_rsa.pub将公钥内容复制到剪切板

2、在github上助长公钥时,直接复制就能够

3、保存

测试:

在终端 ssh -T git@github.com

在github上除了可以应用ssh key的花样外还能利用https的花样。因为只要选拔ssh需求单独为每二个代码仓库配置重新生成ssh key,比较麻烦,由此得以行使https的样式来一向开展网页的操作就能够了。

ssh-keygen -t rsa -C "邮件地址"  

[html] 
Hi <em>username</em>! You've successfully authenticated, but GitHub does not provide shell access. 

利用https地址来交给代码客栈

切切实实的步子和地点的很类似,可是实际的界别在于创设远程旅舍的完结上。(替换掉username 和 客栈名称就足以了)

git remote add origin

 

2.在github页面上增多贰个门类库  create a new repo   ,库名叫username.github.com (本人为:lqg1122.github.com);
然后在地头创立同名文件夹
[html] 
mkdir lqg1122.github.com 
cd lqg1122.github.com 
3.是因为选择到开源的blog 框架 Jekyll-Bootstrap,故要把代码给下载下来
[html] 
git clone  
git add . 
git commit -m "提交新闻:first commit" 
 
git push origin master 

输入指令之后就回车,会现出以下提醒,回车

代码提交成功之后稍等几分钟,张开username.github.com 就能够旁观多个blog 模型了,在经过本人修改,自定义之后才成为自身的隶属博客哦。。偷懒的话, 本地上要设置 rake ,然后在品种文件夹里面输入主旨一见如旧的安装命令,在把修改的代码

[html] view plaincopy

交由就好了。。。。。www.2cto.com
[html] 
sudo apt-get install rake 
rake theme:install git="" 
 
git add . 
git commit -m "提交音信:first commit" 
 
git push origin master 

Enter file in which to save the key (/home/lqg/.ssh/id_rsa):   

Key: [html] ssh-keygen -t rsa -C 邮件地址 输入指令之后就回车,会油不过生以下提醒,回车 [html] Enter file in which to save the key (/home/lqg/.ssh/...

 

继而提醒输入解密钥的加密串:

[html] view plaincopy

Enter passphrase (empty for no passphrase):   

Enter same passphrase again:   

 

输入后有以下提示为打响:

[html] view plaincopy

Your identification has been saved in /home/lqg/.ssh/id_rsa.  

Your public key has been saved in /home/lqg/.ssh/id_rsa.pub.  

The key fingerprint is:  

91:0f:4e:ec:89:ad:3b:75:d1:32:a9:f1:59:ee:8f:9d lqg1122@gmail.com  

The key's randomart image is:  

--[ RSA 2048]----  

本文由澳门正规赌博十大网站发布于澳门游戏网站,转载请注明出处:github工程的本地建立和远程仓库同步,简单记录