git报错The project you were looking for could not be found 解决方式

简介: git报错The project you were looking for could not be found 解决方式

一、拉代码报错The project you were looking for could not be found

问题描述:

使用git从远程仓库克隆项目到本地的时候。

git clone http://gitlab.com/project/xxxx.git

出现这个问题:The project you were looking for could not be found.


原因分析:

  1. 你的账号没有项目的权限,你可以在浏览器输入你的项目地址,如果可以进入,则说明有权限;若不能进入,说明你没有该项目的权限。


  1. 你电脑的git自动保存了其他的用户名密码信息,与当前项目的用户名密码与之前的发生冲突。


解决方案:
1、一次性

克隆的时候远程地址带上用户名及密码即可解决

git clone http://username:password@gitlab.com/project/xxxx.git
2、永久性

清除本地git账户,重新输入用户名与密码。之后再进行git操作时,弹出用户名密码窗口,输入即可。

windows:

git config --system --unset  credential.helper


mac:

git config --global --unset credential.helper


二、提交报错committing is not possible because you have unmerged files.

问题描述:

Committing is not possible because you have unmerged files.


原因分析:

由于您没有合并的文件,因此无法提交。


解决方案:

用git diff或者git status 查看哪些文件冲突,有冲突的会提示:

++<<<<<<< HEAD

++<<<<<<< new_branch


修改你的冲突的文件,然后用git add xxx,把你修改的文件全部都添加进去。之后就是正常的提交流程。


三、项目推送时遇Git推送错误

问题描述:

error: failed to push some refs to 'http://gitlab.com/project/xxxx.git’

原因分析:

这个问题的产生是因为远程仓库与本地仓库并不一致所造成。

解决方案:

把远程库同步到本地库就可以了。

执行命令:

git pull --rebeise origin master

将远程仓库中的更新合并到本地仓库,–rebase的作用是取消掉本地仓库中刚刚的commit


四、项目提交时遇Git错误

问题描述:

error: src refspec master does not match any

原因分析:

引起该错误的原因是,目录中没有文件,空目录不能提交。

解决方案:

执行:

git pull origin master

git push origin master


五、正常流程:

1、克隆代码

把git上的代码拉到本地

2、编辑项目

修改项目代码

3、提交代码

提交到本地仓库保存

4、拉取代码

拉取线上最新代码

5、解决冲突

如果有冲突,先解决冲突,没有则跳过

6、推送代码

把本地代码推送到线上


六、常用命令:

初始化仓库:git init


克隆项目:git clone


添加文件到暂存区:git add


添加当前目录中的所有文件:git add .


提交到本地仓库:git commit -m “”


推送到远程仓库:git push origin


拉取远程仓库所有分支合并到本地:git pull


创建分支:git branch


查看分支:git branch


切换分支:git checkout


删除分支:git branch -d


合并分支:git merge


查看存储库的状态:git status


显示提交历史:git log


目录
相关文章
|
4月前
|
安全 开发工具 git
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
510 5
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
|
4月前
|
Shell Linux 网络安全
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
763 3
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
|
7月前
|
算法 安全 网络安全
git clone操作报错diffie-hellman-group1-sha1的解决方案
在处理这一问题时,需要确保了解相关操作的安全影响。`diffie-hellman-group1-sha1`算法被认为是不够安全的,这是因为随着计算能力的提高,`SHA-1`算法可以在合理的时间内被破解,而且其对应的 `1024位`Diffie-Hellman组也可能不够强大。因此,在确保Git操作的同时,也要考虑提升安全性的长期解决办法。强烈推荐与管理员或相关技术支持团队合作,升级和加强服务器端的安全配置。
197 12
|
8月前
|
网络协议 开发工具 git
解决 git 报错 “fatal: unable to access ‘https://github.com/.../.git‘: Recv failure Connection was rese
在使用 Git/Git小乌龟 进行代码管理的过程中,经常会遇到各种各样的问题,其中之一就是在执行 git clone 或 git pull 等操作时出现 “fatal: unable to access ‘https://github.com/…/.git’: Recv failure Connection was reset” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
5484 1
|
11月前
|
开发工具 git 索引
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
238 21
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
|
10月前
|
Shell 开发工具 git
解决git bash报错:在仓库中检测到可疑的所有权
总的来说,解决“在仓库中检测到可疑的所有权”的报错,关键在于理解和调整文件或目录的所有权。只要我们正确地设置了文件或目录的所有权,那么我们就可以避免这种问题,让Git Bash正常工作。
407 22
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
918 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
开发工具 git
git出现报错:src refspec master does not match any
git出现报错:src refspec master does not match any
1059 0
|
5月前
|
开发工具 git
Git版本控制工具合并分支merge命令操作流程
通过以上步聚焦于技术性和操作层面指南(guidance), 可以有效管理项目版本控制(version control), 并促进团队协作(collaboration).
1196 15
|
8月前
|
安全 开发工具 git
git的常用操作命令
git的常用操作命令
536 57