解决git fatal: No remote repository specified.

简介: 解决git fatal: No remote repository specified.

今天在电脑上,想将gitee切换到github,使用了【git remote rm origin

】,没想到重新关联远程库时,不管是gitee还是github都是失败,直接【git pull】出现如下错误:


user ~/c/xxx$git pull
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.


百度了一下都说.git/config的配置出问题了。

解决方法是从其他项目里拷贝一份config过来,再改一下里面的url就可以了,或者用下面的模板:


[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
[remote "origin"]
        url = https://github.com/Demo/xxx.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl = https://github.com/Demo/xxx.git
[branch "master"]
        remote = origin
        merge = refs/heads/master

把其中换成你项目的地址就可以了:


url = https://github.com/Demo/xxx.git
pushurl = https://github.com/Demo/xxx.git

然而我出现的并不是这种情况,我在对应的目录下查找【.git】文件,哎呀我去,竟然连这个文件都找不到了。于是我二话不说、立马横刀,直接来了句【git init】创建【.git】文件,然后重新【pod install】,嘿嘿嘿~完美解决问题,详见下图:


20180907165626610.png


20180907165637835.png


整个过程下来反思了一下这个问题,我这种情况会报这种错误,可能也有如大多数博客上上说的【.git/config】有问题,这时候千万不要不知道在哪里找这个文件了,否者就搞笑了,当然其具操作如上图。


相关文章
|
5月前
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
113 24
|
20天前
|
开发工具 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 报错如何解决-优雅草卓伊凡
53 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
4月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
313 1
|
6月前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
7月前
|
开发工具 git
成功解决:fatal: detected dubious ownership in repository at ‘E:/workspace/CSMarket‘。如何使用git工具通过命令行的形式
这篇文章分享了作者在使用Git工具初始化本地仓库时遇到的权限问题,提供了通过命令行解决Git仓库权限问题的方案,并介绍了如何使用Git命令行初始化项目、添加文件、提交以及关联远程仓库的步骤。
成功解决:fatal: detected dubious ownership in repository at ‘E:/workspace/CSMarket‘。如何使用git工具通过命令行的形式
|
7月前
|
前端开发 JavaScript PHP
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
|
开发工具 git
git fatal: 拒绝合并无关的历史
记录一个git的错误, 以备以后查看
660 0
|
4月前
|
开发工具 git
git 常用命令
这些只是 Git 命令的一部分,Git 还有许多其他命令和选项,可根据具体需求进行深入学习和使用。熟练掌握这些命令能够帮助你更高效地管理代码版本和协作开发。
|
2月前
|
网络安全 开发工具 git
mac git clone命令提示git@gitee.com: Permission denied (publickey).问题修复
mac git clone命令拉取gitee上项目代码时提示密钥问题
|
2月前
|
Java 网络安全 开发工具
Git进阶笔记系列(01)Git核心架构原理 | 常用命令实战集合
通过本文,读者可以深入了解Git的核心概念和实际操作技巧,提升版本管理能力。

相关实验场景

更多