Git 无法pull代码的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38515203/article/details/82885005

昨天刚解决一个无法使用Git来clone代码的问题,今天就又遇到了一个,代码pull不下来的问题,嗯,总之问题一堆。

先来看看问题吧:

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

说什么呢?就是说,你没有指定一个远程Git仓库的地址,所以它不知道你要从哪儿去pull代码。
额,明明就是从仓库中直接clone的代码,为什么又说没有指定地址呢?不是很清楚,如果有人知道,烦请告诉我一声,不胜感激。
那,遇到这样的情况,该怎么去解决呢?其实,问题的起源就是你的 .git/config 配置错误了。那问题也就简单了,找到你项目中的 .git 文件,在里面有一个 config 文件,打开后,你会看到:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true

一个类似这样的内容,在此基础上,加上你所要pull代码路径的URL就可以了

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

URL添加上去就没问题啦

没错,我pull是《Android群英传》的源码,嘿嘿

猜你喜欢

转载自blog.csdn.net/weixin_38515203/article/details/82885005
今日推荐