gitlab常用功能

git解决 fatal: unable to connect to github.com
原因:
需要用https才能读到数据
解决方法:输入命令
git config --global url."https://".insteadOf git://


git命令执行git clone提示“fatal: unable to access目标地址”的问题
当执行git clone https://github.com/burnszp/guns-lite.git 命令的时候,一直提示无法访问
解决方法:把https改成git即可


git SSL certificate problem: unable to get local issuer certificate
解决方法:
git config --global http.sslVerify false


解决 fatal: Not a git repository (or any of the parent directories): .git 问题
解决方法:
git init


gitlab切换分支
1) 把项目下载到本地 git clone https://(改成完整url)
2) 切换到文件目录下,git branch -a,查看是否存在分支
3) 切换到你想要到的分支
git checkout 分支名
4) 检查是否切换成功,查看当前分支
git branch


切换到D盘
cd d:
进入目录
cd ./saturn/saturn
切换分支
git checkout luochengang


把本地项目上传至gitlab
git pull origin luochengang --allow-unrelated-histories
git commit -am "description"
-a 表示 add
commit前需要git add
git push -u origin luochengang         //第一次push加上-u参数,以后就可以直接使用git push origin luochengang
提交代码流程:
首先pull,然后add,然后commit,最后push


git报错:'fatal:remote origin already exists'
1) 先删除
git remote rm origin


.gitkeep的作用是为了提交空文件夹

撤销“修改并git commit,并且发送到了gitlab”的文件
1) git log查看提交历史记录
我们通过git log可以看到上一次提交的id为e1aa8a5771abee379236b0825e2140c0955bec35,我们使用git revert命令撤销提交(也可以用HEAD代替本次ID)
2) git revert HEAD
3) git log查看提交历史记录


git add总结:
git add -A 提交所有变化
git add -u 提交被修改(modified)和被删除(deleted)文件,不包括新文件(new)
git add . 提交新文件(new)和被修改(modified)文件,不包括被删除(deleted)文件


常用模板:
1) git pull origin luochengang --allow-unrelated-histories
2) git add -A (可以按照需要改成相应的add指令)
3) git commit -m "description"
4) git push origin luochengang

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值