文章目录
使用git bash
查看当前连接的远程仓库
git remote -v
修改连接的远程仓库
git remote set-url origin 仓库地址
查看所有分支
git branch
查看所有的ssh
ls -al ~/.ssh
添加新branch并使用
git checkout -b ugmsbranch
推送的命令
git push origin 分支名
克隆
$ git clone 仓库地址
使用git的步骤
1.全局配置
git config --global user.name 用户名
git config --global user.email 邮箱
2.生成ssh
ssh-keygen -t rsa -C 邮箱
根据日志信息里面的 SSH KEY 存储路径找到 .ssh/id_rsa.pub 文件
默认的
C:\Users\当前用户的名字\.ssh\id_rsa.pub
3.添加到gitlab
秘钥是一串字符,文件拖到浏览器里应该能看见,复制到这个框里添加
4.在项目文件夹里打开gitbush
git remote set-url origin 仓库地址
初始化
git init
5.add
git add 文件名
或者全添加
git add .
6.commit
git commit -m “first commmit”
first commmit是注释
7.push
git push origin 分支名