【问题解决】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
相关推荐
福客AI智能客服2 小时前
从被动响应到主动赋能:家具行业客服机器人的革新路径
大数据·人工智能
小五传输4 小时前
隔离网闸的作用是什么?新型网闸如何构筑“数字护城河”?
大数据·运维·安全
jkyy20144 小时前
AI健康医疗开放平台:企业健康业务的“新基建”
大数据·人工智能·科技·健康医疗
蚁巡信息巡查系统4 小时前
政府网站与政务新媒体检查指标抽查通报如何面对
大数据·内容运营
视界先声5 小时前
2025年GEO自动化闭环构建实践:监测工具选型与多平台反馈机制工程分享
大数据·人工智能·自动化
Elasticsearch5 小时前
Elasticsearch:构建一个 AI 驱动的电子邮件钓鱼检测
elasticsearch
百***24375 小时前
GPT5.1 vs Claude-Opus-4.5 全维度对比及快速接入实战
大数据·人工智能·gpt
alan07216 小时前
【Java + Elasticsearch全量 & 增量同步实战】
java·elasticsearch·jenkins
AI营销前沿6 小时前
私域AI首倡者韩剑,原圈科技领航AI营销
大数据·人工智能
Percent_bigdata6 小时前
数据治理平台选型解析:AI大模型与智能体如何重塑企业数字基座
大数据·人工智能