git 常用操作 及问题记录 Failed to connect to github.com

初始化本地空git存储库 git init
克隆远程仓库 git clone 仓库地址
查看当前本地仓库状态 git status
添加文件到暂存区 git add .
将暂存区内容添加到仓库中 git commit -m ****
提交到远程仓库 git push

分支开发

查看分支
git branch
创建分支
git checkout -b branchName
删除本地分支
git branch -d branchName
删除远程分支
git push origin --delete branchName
切换分支
git checkout branchName
远程添加分支
git push origin branchName
分支流程
git checkout master
git pull
git checkout feature/candide
git merge master
git add .
git commit -m “提交改动”
git push

过滤目录或文件
项目根目录下建立 .gitignore 文件
例:过滤 node_modules 文件夹
在文件中添加一行
node_modules/ 即可!

本地仓库与远程仓库连接,本地仓库终端下
1、git remote add origin https://gitee.com/gao_li_min/my-collect.git
2、git push -u origin master
3、git push -f origin master -----强制推送

回滚前版本
1、 git reset --hard ec696a80aea7efdbb280f97d0737b291bc485228

2、git push -f

清除缓存
git rm -r --cached .

git config --global user.name ‘gaoliming111’

git config --global user.email ‘616436112@qq.com’

Solution1: (原因)自己配置的用户名,邮箱可能输入错误了。查看用户名,邮箱
git config user.name
git config user.email

修改,用户名,邮箱
git config --global user.name “xxx”
git config --global user.email “xxx”

移除仓库,重新添加
git remote rm origin
git remote add origin https://github.com/XXX

Failed to connect to github.com port 443 after 21254 ms: Timed out : git链接超时
//因为http代理原因出现此问题 : git config --global --unset http.proxy

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Min;

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值