git 如何使用 Android Studio 提交和推送 Android 应用程序/项目到预先存在的空 Bitbucket 存储库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24376789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Commit and Push Android App/Project to Pre-existing Empty Bitbucket Repository with Android Studio?
提问by Kurt Wagner
So I'm running the latest version of Android Studio (0.6.1) and want to push to BitBucket because it has free private repos (let's avoid any Github vs BB comments). I've created a simple repo to test the VCS functionality and am using a new Android project with the default configs except the app is called 'TestApp' and the project file is located on my desktop.
所以我正在运行最新版本的 Android Studio (0.6.1) 并想推送到 BitBucket,因为它有免费的私有存储库(让我们避免任何 Github vs BB 评论)。我创建了一个简单的 repo 来测试 VCS 功能,并且正在使用一个带有默认配置的新 Android 项目,除了应用程序名为“TestApp”并且项目文件位于我的桌面上。
I've performed the following steps:
我已经执行了以下步骤:
- VCS>Import into Version Control>Create Git Repository
- Use default path: "C:\Users\User\Desktop\TestApp"
- VCS>Git>Checkout from Version control
- Give https://[email protected]/sanecito/testrepo.gitas VCS path and "C:\Users\User\Desktop\" as parent directory, and testrepo as folder
- When given "Would you like to create an Android Studio project for the sources you have checked out to C:\Users\User\Desktop\testrepo", hit "Yes"
- Create project from existing sources
- Project name: testrepo Project location: C:/Users/User/Desktop/testrepo
- Open project in new window
- Add textfile with text "test" to testrepo in IDE, "Do you want to add the following file to Git? [...]">Yes
- Hit VCS with green arrow button in the menu (Commit Changes)
- Mouse over 'Commit' button, hit commit and push
- Hit 'Push' in next window
- VCS>导入到版本控制>创建 Git 存储库
- 使用默认路径:“C:\Users\User\Desktop\TestApp”
- VCS>Git>Checkout from Version control
- 将https://[email protected]/sanecito/testrepo.git作为 VCS 路径,将“C:\Users\User\Desktop\”作为父目录,将 testrepo 作为文件夹
- 当给出“您是否想为已检出到 C:\Users\User\Desktop\testrepo 的源创建一个 Android Studio 项目”时,点击“是”
- 从现有源创建项目
- 项目名称:testrepo 项目位置:C:/Users/User/Desktop/testrepo
- 在新窗口中打开项目
- 将带有文本“test”的文本文件添加到 IDE 中的 testrepo,“是否要将以下文件添加到 Git?[...]">Yes
- 使用菜单中的绿色箭头按钮点击 VCS(提交更改)
- 将鼠标悬停在“提交”按钮上,点击提交并推送
- 在下一个窗口中点击“推送”
Push window vanishes and there's a brief pop-up window at the bottom that there's "Nothing to push" despite showing in the previous window that there were changes to the project There are several issues with my process, the first is that I would like to create a vanilla Android project and then push to the empty repo, but in my trying to link it it creates a new project (abet without the vanilla app). Even with that new project when I hit commit and push it isn't actually pushed to the repo.
推送窗口消失,底部有一个简短的弹出窗口,尽管在前一个窗口中显示项目发生了更改,但仍有一个简短的弹出窗口我的过程有几个问题,首先是我想创建一个 vanilla Android 项目,然后推送到空的 repo,但在我尝试链接它时,它创建了一个新项目(在没有 vanilla 应用程序的情况下)。即使在我点击提交并推送的新项目中,它实际上并没有被推送到存储库。
I'm aware that there's this question: How to import a Project into bitbucket repository from Android Studio?However, none of the of the answers are useful to solving what should be a simple issue as they aren't descriptive (i.e. how am I even supposed to setup the plug-in). Could someone tell me how to do two things:
我知道有一个问题:How to import a Project into bitbucket repository from Android Studio?但是,没有一个答案对解决什么应该是一个简单的问题有用,因为它们没有描述性(即我什至应该如何设置插件)。有人可以告诉我如何做两件事:
- Setup Git with an existing Android project and application open and push to a repo on BitBucket
- Setup Git config with a fresh Android Studio install such that a person can pull from a BitBucket repo Android app code to work on
- 使用现有的 Android 项目和应用程序设置 Git 并打开并推送到 BitBucket 上的存储库
- 使用全新的 Android Studio 安装设置 Git 配置,以便人们可以从 BitBucket 存储库中提取 Android 应用程序代码以进行处理
回答by Kurt Wagner
The solution in full can be found here: https://www.youtube.com/watch?v=IBEbJUEDWZQ
完整的解决方案可以在这里找到:https: //www.youtube.com/watch?v=IBEbJUEDWZQ
I typed up how to setup the plugin and how pull from a non-empty repo (feel free to use parent directory of your own choosing, I just felt this lead to a clean setup), the video has how to push to an empty repo
我输入了如何设置插件以及如何从非空存储库中提取(随意使用您自己选择的父目录,我只是觉得这会导致设置干净),视频中有如何推送到空存储库
Setting up BitBucket plugin
- Download BitBucket Plugin for IDEA/Android Studio
- At the time of writing (2014/06/25) the official plugindoes not support IDEA13 which the current version of Android Studio (0.6.1) uses. However, there is an unofficial versionthat works (get the latest version)
- Open Android Studio
- On main menu click 'Configure' and then 'Plugins'
- Click 'Install plugin from disk', navigate to the plugin .zip file location, select it, and hit OK.
- Restart Android Studio when prompted
- Download BitBucket Plugin for IDEA/Android Studio
Pull BitBucket repository onto local computer repository
- If Android Studio is not already running, start it
- From the 'Quick Start' menu, select 'Check out from Version Control'
- For 'Parent directory' click "..." on the right and navigate to C:\Users\ [username]\repos
- If 'repos' does not exist, create a new folder by clicking the 'New Folder' button (or hotkey Alt+Insert) and name the new folder 'repos'
- In the 'Checkout from' dropdown select 'BitBucket' and enter BitBucket credentials if prompted
- From the 'Repository list:' dropdown, you should see your desired repo. Select it, and click 'OK'
设置 BitBucket 插件
将 BitBucket 存储库拉入本地计算机存储库
- 如果 Android Studio 尚未运行,请启动它
- 从“快速启动”菜单中,选择“从版本控制签出”
- 对于“父目录”,单击右侧的“...”并导航到 C:\Users\ [用户名]\repos
- 如果“repos”不存在,请单击“新建文件夹”按钮(或热键 Alt+Insert)创建一个新文件夹,并将新文件夹命名为“repos”
- 在“Checkout from”下拉菜单中选择“BitBucket”并在出现提示时输入 BitBucket 凭据
- 从“存储库列表:”下拉列表中,您应该会看到所需的存储库。选择它,然后单击“确定”