【问题解决】Git命令行常见error及其解决方法

以下是我一段时间没有使用xshell,然后用git命令行遇到的一些系列错误和他们的解决方法

遇到了这个报错:

fatal: Not a git repository (or any of the parent directories): .git

我查阅一些博客和资料,可以解决的方式:

复制代码
git init

在我进行git push提交文件时,我遇到了下面这个报错

复制代码
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>

解决方式:

复制代码
 git remote add origin 'http://git.....'
 git push -u origin master

出现了这个报错:

解决方式:

复制代码
git pull --rebase origin master

遇到的报错:

复制代码
error: The following untracked working tree files would be overwritten by checkout

解决方式:

复制代码
git clean -d -fx

遇到的报错:

复制代码
** Please tell me who you are.

Run
  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'lvyp@NEU-20190128LYP.(none)')

解决方式:

意思是说你在创建本地仓库时未定义用户名和邮箱,此时再按照错误提示,利用

复制代码
git config --global user.name "follow"
git config --global user.email "follow@qq.com"

再跟上一句

复制代码
git config --local -l
相关推荐
Runawayliquor7 小时前
opbase:CANN 所有算子的公共地基
大数据·数据库·人工智能·算法
做个文艺程序员7 小时前
第03篇:深入 Mapping 与数据类型设计——ES Schema 设计避坑指南
大数据·elasticsearch·搜索引擎·mapping设计
智塑未来8 小时前
app应用怎么接入广告?标准流程与落地实操方案全解析
大数据·网络·人工智能
️公子8 小时前
线束组装与测试技术
大数据·线束·线束总成
黎阳之光9 小时前
黎阳之光:以视频孪生重构智能监盘,为燃机打造新一代智慧电厂大脑
大数据·人工智能·算法·安全·数字孪生
Lalolander10 小时前
设备工程项目采购中缺料和浪费的痛点和解决思路
大数据·运维·设备工程项目管理系统·设备工程项目质量管控·设备工程项目成本管控
拉卡拉开放平台11 小时前
支付系统在文旅场景的进阶之路:聚合收单、分账与自动化对账
大数据·人工智能·自动化
互联网推荐官11 小时前
2026上海GEO优化服务商综合实力深度评测
大数据·人工智能·技术分享·geo·上海
QYR_1111 小时前
4.3% 年复合增速:2026全球救生衣灯市场格局与海事合规发展报告
大数据·人工智能
铭毅天下12 小时前
Easysearch 版本进化全图——从 ES 国产替代到 AI Native 搜索数据库
大数据·数据库·人工智能·elasticsearch·搜索引擎