【问题标题】:GIthub repository not found error on Android Studio 2.1.2 after changing the repository更改存储库后,在 Android Studio 2.1.2 上未找到 GIthub 存储库错误
【发布时间】:2023-03-05 01:19:01
【问题描述】:

我删除了旧的 Github 存储库(名称:RealmDemo)并使用新名称创建新的存储库:daftar-negatif-investasi。我在 Windows 10 上,我删除了旧的远程存储库并使用以下命令(使用 Git Bash)添加了新的远程存储库:

git remote rm origin
git remote add https://github.com/masumo/daftar-negatif-investasi.git 

但是,Android Studio 总是给我这个错误信息:

失败并出现错误:致命:存储库 'https://github.com/masumo/RealmDemo.git/' 未找到

当我尝试推送到我的 Github 存储库时。

我相信远程存储库已经改变了,因为运行git remote -v 命令会给我这个结果:

origin  https://github.com/masumo/daftar-negatif-investasi.git (fetch)
origin  https://github.com/masumo/daftar-negatif-investasi.git (push)

Android Studio 似乎仍然引用旧的存储库。这个问题有什么解决办法吗?

【问题讨论】:

    标签: android-studio github


    【解决方案1】:

    试试这个:

    打开 /.git/config 文件并删除行:

    [remote "origin"]
        url = https://github.com/githubaccountname/MyProject.git
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    【讨论】:

    • 我没有在我的 gitconfig 中找到这些行。以下是完整内容: [gui] recentrepo = C:/Users/Kosumo/AndroidStudioProjects/DaftarNegatifInvestasi [user] email = mas.kosumo@gmail.com name = masumo
    • 你说,当你推送到你的仓库时,Android Studio 会出错。可以通过命令行手动推送吗?
    • 感谢您为我指明正确的方向。这是我的愚蠢......当我应用所有这些命令时,它发现我在另一个目录(我的项目目录的两个上层)上工作。我应该接受你的回答还是直接关闭这个问题?
    • @masu.mo:您可以创建您的答案并接受它。还是我应该创建它?
    • @masu.mo:很好,然后点击“接受为答案”接受它。 Horas dari medan :)
    【解决方案2】:
    git remote rm origin 
    git remote add origin git@github.com:username/MyApplication.git
    git push -u origin master
    

    那么它应该可以工作了。

    【讨论】:

      【解决方案3】:

      尝试添加origin

       git remote add origin https://github.com/user/repo.git
      

      【讨论】:

      • 我尝试删除并重新添加它。它仍然给了我同样的错误。
      【解决方案4】:

      这是我未能识别工作目录。在我将项目重构为新名称后,Git Bash 应用程序以某种方式将默认工作目录移动到上层。我没有注意到这一点,所有这些命令都是针对我的新项目目录的上层执行的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-12-16
        • 2013-12-03
        • 2011-09-19
        • 2019-06-17
        • 1970-01-01
        • 2016-04-15
        • 2010-10-26
        相关资源
        最近更新 更多