git初次使用

32 阅读1分钟

(1)初始化新仓库

mkdir my-project
cd my-project
git init  # 初始化 Git 仓库

(2)配置证书

ssh-keygen -t rsa -C “自己的邮箱”
(中途一直按enter就可以)

配置后可得到ssh公钥,打开图1中的.pub文件,复制文本内容,添加到图二,才配好了证书

image.png

image.png

(3)配置用户信息

git config --global user.name "ziyi.ye_UI-MH"
git config --global user.email "ziyi.ye@ui-mh.com"

(4)克隆现有仓库

git clone https://github.com/username/repo.git
若无法clone 可以尝试
git clone https://账号:密码@github.com/username/repo.git