“Nothing to push” error in Android studio with Git
2015-05-18 11:07
656 查看
在Android studio下使用git
参考:http://www.tuicool.com/articles/V7j6Zfq1.准备安装 git :
sudo apt-get install git-core参考:https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-12-04
在Android studio中设置git插件:File->Setting->Version Control->Git, 然后可以点击Test测试一下,如下图:那么你就设置成功了。
2.初始化git项目(git init)
操作如下:VCS->Enable Control Integration->Select "Git".3.为git添加remote
在这一步中,studio没有为我们提供可视化的GUI,在terminal下将目录切换到项目的目录,然后输入git添加remote的命令,例如:git remote add origin "https://github.com/xxx/xxx.git".4.将代码添加到VCS(git add)
选中要提交的文件->VCS->Git->Add5.提交变化(git commit)
VCS->Commit Changes在提交的时候可以选择Commit and Push,就可以直接push到服务器。在第一次提交时可能会出现 “Nothing to push” 的问题
参考:http://stackoverflow.com/questions/15913669/nothing-to-push-error-in-intellij-with-git
因为第一次提交,repository为空,没有master,你需要 在push界面中最下方的checkbox上挑勾,选择"Push current branch to alternative branch"并且填写为master即可,这样就能建立master,以后push就不需要checkbox了,除非添加新的分支。
When you push to an empty repository you must set on checkbox "Push current branch to alternative branch" and choose
masteras that alternative.It's because
masteris not created yet (repo is
really empty). But doing this way you can pretend to initialize the repository.
While that checkbox is off and repository is empty, IDEA can't push, because its interface must be safe and he will not just create new brach if the one in which you pushed last accidentally disappeared (or just not exist). You must force that "branch creation"
相关文章推荐
- Error:Failed to find target with hash string 'android-25' in: E:\androidstudio\androidstudio\sdk
- Error:Cause: failed to find target with hash string 'N' in: F:\Androidstudio\android-sdk-windows <a
- android studio Cause:failed to find target with hash string 'android - 17' in...
- Error: Configuration with name 'default' not found in Android Studio 解决
- git push github失败,提示:SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
- How to Resolve the 'Error MSB6006 tsc.exe exited with code 2' build error in Visual Studio 2015
- How to Solve Key_read Failed Error in Git Push
- git android.google 源码:Unknown SSL protocol error in connection to code.google.com:443
- Conversion to Dalvik format failed with error 1 in Android on export
- VS2015中使用Git遇到问题 Cannot do push / pull in git - working with visual studio
- Android Studio Error: Failed to resolve:third-party-libraries:1.0.0 Show in File Show in Proje
- Git push 报错 "error: failed to push some refs to " 解决
- git error: failed to push some refs to
- ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing
- AndroidStudio Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 錯誤解決方法
- [Android]Error running app: This version of Android Studio is incompatible with the Gradle Plugin us
- Error:Conflict with dependency 'com.android.support:support-v4' in project ':app'...解决方案
- Error running demo: This version of Android Studio is incompatible with the Gradle Plugin used.
- Android Studio Error:null value in entry: outputDirectory=null编译报错问题
- Android Studio Error Solution: Please change caller according to ......