【问题解决】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
相关推荐
lupai12 分钟前
手机在网状态查询 API 新手实战指南
大数据·python·智能手机
AI_Auto31 分钟前
工业与AI融合应用 | 四个实战用例!机械装备行业AI+数字孪生+机器人落地全景
大数据·人工智能·机器人·制造
拓海SEO外贸32 分钟前
Google 爬虫管理:抓取预算、404 与重定向
爬虫·搜索引擎·信息可视化·seo·跨境电商·独立站搭建·seo优化
小羊Yveesss1 小时前
模板建站哪个平台好?模板数量之外还要比较编辑与SEO能力
大数据·人工智能·小程序
千瓜2 小时前
用户洞察:负鼠走红?解读新世代“动物人格”
大数据·人工智能·数据分析·生活·新媒体
liuliuqiqirr3 小时前
2026最新两款AI编程工具深度对比实测
大数据·ai编程
cspttty3 小时前
数字经济没有项目经验,怎么补就业短板
大数据·人工智能
数智化管理手记3 小时前
应收应付资金占用过高怎么办?应收应付搭配账龄分析怎么做
大数据·网络·数据库·人工智能·数据挖掘
大大大大晴天3 小时前
Hudi技术内幕:Compaction原理与实践
大数据
zyplayer-doc4 小时前
研发接口文档怎么长期维护:zyplayer-doc把API、Markdown和变更记录放进同一个知识库
大数据·数据库·人工智能·笔记·pdf·ocr