简体   繁体   English

在github上设置一个AndroidStudio项目

[英]Setting up an AndroidStudio project on github

So I'm having difficulty setting up an Android Studio project on GitHub. 所以我很难在GitHub上建立一个Android Studio项目。

Here's my issue: 这是我的问题:

I can't find a way to push the project on GitHub, then clone it and have it maintain it's project structure. 我找不到一种方法可以在GitHub上推送项目,然后对其进行克隆并保持其项目结构。

I've tried a few different things but In every step I simply created a new android project with a simple empty activity to test how GitHub/AndroidStudio would work. 我尝试了一些不同的方法,但是在每一步中,我只是创建了一个新的android项目,该项目具有一个简单的空活动来测试GitHub / AndroidStudio的工作方式。

  1. I tried using a .gitignore file from a old StackOverflow post : What should be in my .gitignore for an Android Studio project? 我尝试使用旧StackOverflow帖子中的.gitignore文件: 对于Android Studio项目,我的.gitignore应该包含什么?

But then I noticed that when I clone my project, and select import existing project in android studio, it changes the entire project structure to the point that it won't even recognize that it's an app. 但是后来我注意到,当我克隆项目并选择在android studio中导入现有项目时,它会将整个项目结构更改为甚至无法识别它是一个应用程序。 It won't even run let alone see the manifest. 它甚至不会运行,更不用说看清单了。

So now I tried another solution: 所以现在我尝试了另一种解决方案:

  1. I simply tried pushing the entire project directory to Github. 我只是尝试将整个项目目录推送到Github。
  2. I did git init inside the project directory, and tried to do a git remote add 我在项目目录中执行了git init,并尝试执行git remote add
  3. However when I do a git remote -v I can see my repo but a git branch -a or git branch won't show any branches other than my master branch.... EDIT: It seems in order to see the branches I NEED to use git clone. 但是,当我执行git remote -v时,我可以看到我的仓库,但是git分支-a或git分支不会显示除我的master分支以外的任何分支。...编辑:看来是为了查看我需要的分支使用git clone。 I wasn't encountering this problem earlier... 我之前没有遇到这个问题...

I can't seem to get anything to work XD 我似乎什么也无法工作XD

I've been trying to find an introductory guide, but it seems that appart from "Enter your GitHub info and push/pull away via the GUI!" 我一直在尝试找到入门指南,但似乎“从您的GitHub信息输入并通过GUI推/拉! is as far as it goes. 就目前而言。

Any help would be great. 任何帮助都会很棒。

To copy a previously answered question: 复制先前回答的问题:

Open the project you want to push in Android Studio. 在Android Studio中打开您要推送的项目。

Click VCS -> Enable version Control Integration -> Git 单击VCS->启用版本控制集成-> Git

There doesn't seem to be a way to add a remote through the GUI. 似乎没有办法通过GUI添加遥控器。 So open Git Bash in the root of the project and do git remote add 因此,在项目的根目录中打开Git Bash并执行git remote add

Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI. 现在,当您执行VCS->提交更改->提交并推送时,您应该看到您的遥控器,并且所有内容都应通过GUI正常工作。

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

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