【问题解决】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
相关推荐
老陈头聊SEO6 分钟前
优化SEO效果的长尾关键词运用与关键词调整策略分析
其他·搜索引擎·seo优化
奋斗者1号18 分钟前
解决Git Push Gerrit分支失败的全流程实战
大数据·git·elasticsearch
2601_9492210320 分钟前
边缘智算加速重构算力格局,微模块技术筑牢低延时基础设施底座
大数据·人工智能·重构
一只鹿鹿鹿25 分钟前
网络安全风险评估报告如何写?(Word文件)
java·大数据·spring boot·安全·web安全·小程序
网安情报局27 分钟前
2026网络安全六大确定性趋势
大数据·人工智能·网络安全
小白学大数据35 分钟前
如何判断网站流量飙升是搜索引擎爬虫导致的?
爬虫·scrapy·搜索引擎·pycharm
yhdata36 分钟前
聚焦半导体关键部件:磁悬浮无轴泵市场前景明朗,2032年规模逼近15.12亿元
大数据·人工智能
margu_16837 分钟前
【Elasticsearch】es7.2 跨集群迁移大量数据
elasticsearch
财迅通Ai41 分钟前
莎普爱思高溢价收购上海勤礼100%股权:转型关键落子与多重风险交织
大数据·人工智能·区块链·莎普爱思
SaaS_Product41 分钟前
企业网盘哪个好?企业网盘选型需求分析
大数据·云计算·saas·onedrive