【问题标题】:Can't push to bitbucket because no remotes are defined无法推送到 bitbucket,因为没有定义遥控器
【发布时间】:2015-07-12 15:49:43
【问题描述】:

我无法通过 Android Studio 将我的项目推送到 Bitbucket,因为没有定义遥控器。我使用这个 Stackoverflow 问题作为来源,但没有帮助:

Can't push to git via Android studio?

*注意:远程和/或来源可能已被意外删除。此外,可能已经从这个项目创建了两个存储库或根。 (我知道,我知道...)

我才刚刚开始使用 git 和 bitbucket,我希望我没有毁了我的项目。提交工作正常,直到 git 屏幕显示为空白并在底部显示“......没有定义遥控器”。是否有快速解决方案,或者可以为我的项目创建另一个新存储库?

这是我项目的 config.git 文件:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    url = https://xxxxxx@bitbucket.org/xxxxxx/yyyyyy.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

如果您发现此配置文件中有任何错误,或者我应该查看其他配置文件,请告诉我...

有什么建议吗?

更新

Git Bash 中,我添加了另一个遥控器并调用git remove remote origin。然后我在新遥控器上打电话给git push,它工作了。但是,这只适用于Git Bash。在 Android Studio 上,它仍然说没有定义遥控器......我想知道我是否应该在 Android Studio 上配置一些东西?

更新2

现在我收到这个奇怪的错误:

Error:error: pathspec 'appname/src/main/res/drawable/back.png' did not match any file(s) known to git.
 during executing git commit --only -F C:\Users\xxxxxxxx\AppData\Local\Temp\git-commit-msg-5810111251677391833.txt --

【问题讨论】:

    标签: android git bitbucket


    【解决方案1】:

    解决方案 1:

    转到 Git bash。 cd 到您的项目文件夹并使用以下命令再次添加遥控器

    git remote add origin "在此处粘贴您的 bitbucket 链接"

    eg - git remote add origin https://kanand90@bitbucket.org/kanand90/algorithms.git

    通过键入检查您是否正确设置了遥控器

    git 远程 -v

    这应该会显示您的推拉遥控器。我认为这应该可以解决问题。

    解决方案 2:

    只需在其他位置复制您的项目(复制和粘贴)即可。从新副本中物理删除 .git。再次将新副本导入 android studio。转到版本控制系统(VCS)-> 导入版本控制-> 在 github 或 bitbucket 上共享项目(无论您设置了哪个)。然后输入主密码和新的存储库名称。那么你的设置就完成了。

    【讨论】:

    • "git remote add origin "Paste your bitbucket link here"。我这样做并得到了结果:"fatal: remote origin already exists"。然后当我执行 git remove -v 我得到两个结果: 来源 https...project.git(fetch) 和来源 https...project.git(push)
    • 改用git remote set-url origin <your-bitbucket-url>
    • 不幸的是,这些似乎都不起作用。如何从新副本中物理删除 git?它是Git Bash 中的命令行代码还是只是找到 git 文件并按删除?
    • 也许可以看看我上面的更新?可能是 Android Studio 的问题?
    • 如何从新副本中物理删除 git?有多少个 git 文件?
    猜你喜欢
    • 2019-01-29
    • 2018-11-10
    • 2017-12-20
    • 2018-12-29
    • 2017-12-16
    • 1970-01-01
    • 2019-03-18
    • 1970-01-01
    • 2018-09-27
    相关资源
    最近更新 更多