添加HTTPS和SSH连接
This commit is contained in:
parent
86dc58dd7a
commit
e78a63a61e
50
git01.md
50
git01.md
@ -1,4 +1,4 @@
|
|||||||
## git 版本库初始化与文件提交操作
|
## 一、git 版本库初始化与文件提交操作
|
||||||
|
|
||||||
### 1. 初始化 git 仓库
|
### 1. 初始化 git 仓库
|
||||||
```
|
```
|
||||||
@ -29,3 +29,51 @@ git commit -m 'git版本库初始化与文件提交操作'
|
|||||||
git log
|
git log
|
||||||
```
|
```
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
## 二、使用 Https 推送至远程仓库
|
||||||
|
|
||||||
|
### 1. 新建远程仓库
|
||||||
|

|
||||||
|
|
||||||
|
### 2. 将建立好的本地库绑定并推送至远程仓库
|
||||||
|
```
|
||||||
|
git remote add origin https://git.chenguanzhou.com/xhong/git-study-md.git
|
||||||
|
git push -u origin master
|
||||||
|
```
|
||||||
|

|
||||||
|
|
||||||
|
## 三、使用 SSH 加密推送
|
||||||
|
|
||||||
|
### 1. 本地生成 SSH 公钥和秘钥
|
||||||
|
```
|
||||||
|
ssh-keygen -t rsa -C "远程仓库的邮箱地址"
|
||||||
|
```
|
||||||
|

|
||||||
|
|
||||||
|
### 2. 查看生成的公钥 & 秘钥
|
||||||
|
> 文件位置:用户 > 本机用户名 > .ssh文件夹
|
||||||
|
```
|
||||||
|
第一个是密钥,第二个是公钥(*.pub)
|
||||||
|
```
|
||||||
|

|
||||||
|
> 用记事本打开生成的 SSH 公钥
|
||||||
|
|
||||||
|
### 3. 远程绑定 SSH 公钥
|
||||||
|
> 添加密钥
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> 查看密钥
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> 检查测试链接
|
||||||
|
```
|
||||||
|
ssh -T git@git.chenguanzhou.com
|
||||||
|
```
|
||||||
|
### 4. 将建立好的本地库绑定并推送至远程仓库
|
||||||
|
```
|
||||||
|
git remote add origin git@git.chenguanzhou.com:xhong/git-study-md.git
|
||||||
|
git push -u origin master
|
||||||
|
```
|
BIN
git01_files/3.jpg
Normal file
BIN
git01_files/3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 179 KiB |
BIN
git01_files/4.jpg
Normal file
BIN
git01_files/4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
BIN
git01_files/5.jpg
Normal file
BIN
git01_files/5.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
git01_files/6.jpg
Normal file
BIN
git01_files/6.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
git01_files/7.jpg
Normal file
BIN
git01_files/7.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
BIN
git01_files/8.jpg
Normal file
BIN
git01_files/8.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 157 KiB |
Loading…
x
Reference in New Issue
Block a user