解决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】有问题,这时候千万不要不知道在哪里找这个文件了,否者就搞笑了,当然其具操作如上图。


相关文章
|
开发工具 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
256 24
|
5月前
|
网络协议 开发工具 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” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
2791 0
|
9月前
|
开发工具 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 报错如何解决-优雅草卓伊凡
748 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
574 1
|
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
|
前端开发 JavaScript PHP
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
178 0
|
开发工具 git
git fatal: 拒绝合并无关的历史
记录一个git的错误, 以备以后查看
927 0
|
2月前
|
开发工具 git
Git版本控制工具合并分支merge命令操作流程
通过以上步聚焦于技术性和操作层面指南(guidance), 可以有效管理项目版本控制(version control), 并促进团队协作(collaboration).
405 15
|
5月前
|
安全 开发工具 git
git的常用操作命令
git的常用操作命令
384 57
|
3月前
|
存储 缓存 开发工具
Git stash命令的详细使用说明及案例分析。
通过上述案例,我们看到stash命令能够在不丢失进度的情况下,帮助开发者临时切换开发上下文,这在处理多个任务或紧急bug时特别有用。正确使用Git stash可以大大提高开发的灵活性和效率。
1329 0