【问题标题】:Can I safely delete old repository link from the git config file?我可以从 git 配置文件中安全地删除旧的存储库链接吗?
【发布时间】:2022-04-02 02:33:51
【问题描述】:

当我第一次安装 git 时,我使用了错误的存储库链接。

我可以看到,在我的 Android Studio 项目的 .git 文件夹中找到的配置文件中有以下设置:

ignorecase = true
[remote "origin"]
url = https://github.com/NrkSensors/Android.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch]
autosetuprebase = always
[branch "master"]
rebase = true
remote = origin
merge = refs/heads/master
[remote "github"]
url = https://github.com/Muuddz/AndroidApp.git
fetch = +refs/heads/*:refs/remotes/github/*

我想删除它https://github.com/Muuddz/AndroidApp.git 因为这个存储库不存在了。我在 Android Studio 中找不到任何方法来更改它。我应该从文件中删除什么以不损坏任何内容?

【问题讨论】:

  • @VKatz 它通过从文件的行中删除它来工作

标签: android git android-studio


【解决方案1】:

如果您只想更改您的remote url,那么您不能从终端进行如下操作

git remote set-url origin "your remote url"

EDIT : 如果你想删除那个错误的 url,只需执行以下命令

git remote remove github

【讨论】:

    【解决方案2】:

    打开你的配置文件vi .git/config 并删除行

    [remote "github"] url = https://github.com/Muuddz/AndroidApp.git fetch = +refs/heads/*:refs/remotes/github/*

    然后使用

    git remote set-url origin "https://github.com/NrkSensors/Android.git"
    

    世界会再次幸福!

    【讨论】:

      猜你喜欢
      • 2012-06-29
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 2019-12-09
      • 2013-10-25
      • 1970-01-01
      • 1970-01-01
      • 2011-03-28
      相关资源
      最近更新 更多