简体   繁体   English

无法通过Android工作室推送到git?

[英]Can't push to git via Android studio?

I cloned a Repository from Github via Android Studio. 我通过Android Studio从Github克隆了一个Repository。 I made some changes to the code, then committed & pushed without a problem. 我对代码进行了一些更改,然后提交并推送没有问题。 Today, I made some changes to the code. 今天,我对代码做了一些修改。 I committed them but when I tried to push them it says 我承诺了,但当我试图推动它时,它说

Can't push, because no remotes are defined 不能推,因为没有定义遥控器

在此输入图像描述 Thanks for your help.. 谢谢你的帮助..

Apparently there's no way to do it from the IDE, some bug must have deleted your remote. 显然,没有办法从IDE中执行此操作,某些bug必须删除您的遥控器。 If you open up the config file in your .git directory within your project folder, goto the bottom and insert: 如果打开项目文件夹中.git目录中的配置文件,请转到底部并插入:

[remote "origin"]
url = https://github.com/YOURPROFILE/YOURREPO.git

Maybe, it is late to answer, but I got related problem yesterday in IDEA. 也许,现在回答很晚,但昨天我在IDEA得到了相关的问题。 I have separate repository for each module and when I initially checkout them into local repository all remotes were called origin . 我为每个模块都有单独的存储库,当我最初将它们签入本地存储库时,所有远程控制都被称为origin Yesterday I changed remotes for some modules but not by replacing - by adding new_remote and removing origin . 昨天我改变了一些模块的遥控器,但没有更换 - 通过添加new_remote和删除原点 So I got smth like that: 所以我得到了那样的东西:

module_1 -> {new_remote/master}
module_2 -> {origin/master}
module_3 -> {origin/master}
...
module_n -> {new_remote/master}

From that moment I received error Can't push, because no remotes are defined every time I tried to push. 从那一刻起,我收到错误无法推送,因为每次我试图推送都没有定义遥控器 In git bash all worked fine, but not in IDEA. 在git bash中一切正常,但在IDEA中没有。 I spent whole day and at evening I tried last solution and it worked - I changed all local repositories to have identically named remotes . 我花了一整天的时间,晚上我尝试了最后的解决方案并且它有效 - 我将所有本地存储库更改为具有相同名称的遥控器 In my case, I renamed origin for modules to new_remote . 在我的例子中,我将模块的原点重命名为new_remote As I understant you can have smth like this: 正如我所知,你可以像这样:

module_1 -> {origin->[master, test], staging->[master]}
module_2 -> {origin->[master], staging->[master]}
module_3 -> {origin->[master, test]}

But from Intellij native plugins in this case you will be able to push only to {origin->[master]}, because only this remote/branch pair is common to all registered in this project repositories. 但是在这种情况下,从Intellij本机插件中,您将只能推送到{origin - > [master]},因为只有这个远程/分支对对于此项目存储库中注册的所有人都是通用的。

ALso, it seems that this limitation wil be fixed in later versions. 此外,似乎这个限制将在以后的版本中修复。 - https://youtrack.jetbrains.com/issue/IDEA-81620 - https://youtrack.jetbrains.com/issue/IDEA-81620

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM