网站首页 > 博客文章 正文
Git 是当下最常用的代码管理库,是程序员日常工作中使用频率最高的工具,在频繁的使用过程中,难免会遇到各种各样的问题,今天跟大家分享 Git 常见的错误和解决方法。
问题一:
执行Git add 'somefile'的时候,出现如下错误:
If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue.
解决方法:
rm -f ./.git/index.lock
问题二:
输入git push origin master提示出错信息:
error:failed to push som refs to .......
解决办法:
1)先输入git pull origin master先把远程服务器github上面的文件拉下来
2)再输入git push origin master
3)如果出现报错 fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal: Could not read from remote repository.
4)则需要重新输入git remote add 仓库地址
问题三:
当我们有时候回滚了代码,想强制push到远程仓库的时候,执行git push origin --force会报如下错误:
You are not allowed to force push code to a protected branch on this project
解决办法:
如果用的是gitlab版本库,这说明gitlab对仓库启用了保护,需要在仓库中设置一下:
问题四:
使用 Git 添加远程github仓库的时候提示错误:
fatal: remote origin already exists.
解决方法:
1)先删除远程 Git 仓库
git remote rm origin
2)再添加远程 Git 仓库
git remote add origin 仓库地址
如果执行 git remote rm origin 报错的话,我们可以手动修改gitconfig文件的内容
vi .git/config
把 [remote “origin”] 那一行删掉就好了。
问题五:
切换分支git checkout -b release-1.0,提示报错:
fatal: The current branch release-1.0 has no upstream branch. To push the current branch and set the remote as upstream, use
解决方法:
git push --set-upstream origin release-1.0
问题六:
使用git pull代码时,经常会碰到有冲突的情况,提示如下信息:
error: Your local changes to 'c/environ.c' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge.
解决方法:
这个意思是说更新下来的内容和本地修改的内容有冲突,先提交你的改变或者先将本地修改暂时存储起来。
1)先将本地修改存储起来 ,保存当前工作进度,会把暂存区和工作区的改动保存起来
git stash
2)把远程的文件pull下来
git pull
问题七:
如果输入ssh -T git@github.com出现错误提示:
Permission denied (publickey).
因为新生成的key不能加入ssh就会导致连接不上github。
解决办法:
1)先输入ssh-agent,再输入ssh-add ~/.ssh/id_key,这样就可以了。
2)如果还是不行的话,输入ssh-add ~/.ssh/id_key命令后出现报错Could not open a connection to your authentication agent.解决方法是key用Git Gui的ssh工具生成,这样生成的时候key就直接保存在ssh中了,不需要再ssh-add命令加入了,其它的user,token等配置都用命令行来做。
3)最好检查一下在你复制id_rsa.pub文件的内容时有没有产生多余的空格或空行,有些编辑器会帮你添加这些的。
问题八:
编译ICS时出现如下错误:
build/core/Java.mk:20: *** dalvik/dexgen: Invalid LOCAL_SDK_VERSION '4' Choices are: current . Stop.
解决方法:
rm -rf prebuilt ; repo sync prebuilt
幽你一默
当我试图把一个bug踢给别人的时候....
猜你喜欢
- 2024-10-10 Nutch-Hadoop-MongoDB搭建分布式爬虫
- 2024-10-10 OpenSSH更新至8.0,修复存在35年的安全漏洞
- 2024-10-10 [python] 基于paramiko库操作远程服务器
- 2024-10-10 利用Zabbix监控系统SSH方式检测远程目标主机
- 2024-10-10 手工方式IPSec VPN配置保障单位与分支之间的数据安全
- 2024-10-10 SSH 简介:安全远程访问的利器(安全远程登录协议ssh)
- 2024-10-10 [ Laravel 5.6 文档 ] 快速入门 —— 重量级开发环境:Homestead
- 2024-10-10 快速上手:Docker环境下的WordPress安装全攻略
- 2024-10-10 阿里云服务器Centos7.3安装Git(阿里云服务器centos装桌面)
- 2024-10-10 如何使用ssh密钥登录远程服务器(如何使用ssh密钥登录远程服务器账号)
你 发表评论:
欢迎- 367℃用AI Agent治理微服务的复杂性问题|QCon
- 358℃初次使用IntelliJ IDEA新建Maven项目
- 356℃手把手教程「JavaWeb」优雅的SpringMvc+Mybatis整合之路
- 351℃Maven技术方案最全手册(mavena)
- 348℃安利Touch Bar 专属应用,让闲置的Touch Bar活跃起来!
- 346℃InfoQ 2024 年趋势报告:架构篇(infoq+2024+年趋势报告:架构篇分析)
- 345℃IntelliJ IDEA 2018版本和2022版本创建 Maven 项目对比
- 342℃从头搭建 IntelliJ IDEA 环境(intellij idea建包)
- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)