This commit is contained in:
34
Git/Git免密拉取代码.md
Normal file
34
Git/Git免密拉取代码.md
Normal file
@@ -0,0 +1,34 @@
|
||||
> 本文作者:丁辉
|
||||
|
||||
# Git免密拉取代码
|
||||
|
||||
## 第一种
|
||||
|
||||
1. 生成密钥
|
||||
|
||||
```bash
|
||||
ssh-keygen
|
||||
```
|
||||
|
||||
2. 查看密钥
|
||||
|
||||
```bash
|
||||
cat ~/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
2. 到代码仓库配置 SSH 密钥直接 git clone 免密拉取
|
||||
|
||||
|
||||
|
||||
## 第二种
|
||||
|
||||
在命令里使用账号密码或令牌拉取
|
||||
|
||||
```bash
|
||||
git clone -b main --depth=1 https://$GIT_USERNAME:$GIT_PASSWORD@github.com/offends/demo.git
|
||||
```
|
||||
|
||||
```bash
|
||||
git clone -b main --depth=1 https://$GIT_TOKEN@github.com/offends/demo.git
|
||||
```
|
||||
|
Reference in New Issue
Block a user