Compare commits
No commits in common. "a54f0c74b9cf6ba8ed3beb56d18e7c505f4c2267" and "86dc58dd7a818c98ce468a9c8af2a21a2f5d8655" have entirely different histories.
a54f0c74b9
...
86dc58dd7a
59
git01.md
59
git01.md
@ -1,4 +1,4 @@
|
||||
## 一、git 版本库初始化与文件提交操作
|
||||
## git 版本库初始化与文件提交操作
|
||||
|
||||
### 1. 初始化 git 仓库
|
||||
```
|
||||
@ -6,23 +6,16 @@ git init
|
||||
```
|
||||
|
||||
### 2. 添加到暂存区
|
||||
> 添加指定文件
|
||||
|
||||
```
|
||||
git add git01.md
|
||||
```
|
||||
|
||||
> 添加全部文件
|
||||
|
||||
```
|
||||
git add .
|
||||
```
|
||||
|
||||
### 3. 检查状态
|
||||
```
|
||||
git status
|
||||
```
|
||||
|
||||
|
||||
### 4. 提交到本地库
|
||||
```
|
||||
git commit -m 'git版本库初始化与文件提交操作'
|
||||
@ -36,51 +29,3 @@ git commit -m 'git版本库初始化与文件提交操作'
|
||||
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
|
||||
```
|
Binary file not shown.
Before Width: | Height: | Size: 179 KiB |
Binary file not shown.
Before Width: | Height: | Size: 94 KiB |
Binary file not shown.
Before Width: | Height: | Size: 88 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
Before Width: | Height: | Size: 213 KiB |
Binary file not shown.
Before Width: | Height: | Size: 157 KiB |
Loading…
x
Reference in New Issue
Block a user