简体   繁体   English

无法从 Android 工作室向 bitbucket 推送新项目?

[英]Cant push new project to bitbucket from Android studio?

I created a new project in Android Studio.我在 Android Studio 中创建了一个新项目。 But I can not push it to bitbucket (I fight with it for all day, nothing works).但我不能把它推到 bitbucket(我和它打了一整天,没有任何效果)。

I get this error:我收到此错误:

Push to origin/master was rejected
error: failed to push some refs to 'https://aaa@bitbucket.org/bbb/ccc.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
!   refs/heads/master:refs/heads/master [rejected] (fetch first)
hint: (e.g., 'git pull ...') before pushing again.
Done
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

And this is what I do:这就是我所做的:

  1. Android Studio (AS) -> New project Android 工作室 (AS) -> 新项目
  2. AS -> VCS -> Enable Version Control integration -> Git AS -> VCS -> 启用版本控制集成 -> Git
  3. AS -> VCS -> Git -> Remotes -> I added URL of repository I created in bitbucket AS -> VCS -> Git -> Remotes -> 我添加了我在 bitbucket 中创建的存储库 URL
  4. AS -> Right click on project => Git => Commit & Push - > ERROR AS -> 右键单击项目 => Git => 提交并推送 -> 错误

What is the problem?问题是什么? I dont understand the error message, I do not have any "another repository", it is just me working on this project, and it is newly created.我不明白错误消息,我没有任何“另一个存储库”,只有我在处理这个项目,而且它是新创建的。

When I try to follow advice to PULL changes, it also does not work (I get another error).当我尝试遵循 PULL 更改的建议时,它也不起作用(我收到另一个错误)。 And when I try to google that one, I get another one and another one and I soon I get lost...its very complicated.当我尝试用谷歌搜索那个时,我得到了一个又一个,很快我就迷路了……它非常复杂。

What am I doing wrong?我究竟做错了什么? All I want is just to push a new project to bitbucket...我只想推一个新项目到bitbucket...

Ok, I solved it.好的,我解决了。 I have no idea why git kept giving me those random errors (when both repo and project were fresh and just minutes old, those error messages ddint make much sense), but this is what helped:我不知道为什么 git 一直给我那些随机错误(当 repo 和项目都是新鲜的并且只有几分钟的时候,这些错误消息 ddint 很有意义),但这有帮助:

git push -f --set-upstream origin master

I guess it is just another proof how complicated, and unintuitive git is.我想这只是 git 是多么复杂和不直观的另一个证明。

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

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