1.5 KiB
1.5 KiB
一、git 版本库初始化与文件提交操作
1. 初始化 git 仓库
git init
2. 添加到暂存区
添加指定文件
git add git01.md
添加全部文件
git add .
3. 检查状态
git status
4. 提交到本地库
git commit -m 'git版本库初始化与文件提交操作'
5. 操作截图
6. 查看提交日志记录
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