How to add Android-Project to GitHub [duplicate] - android

This question already has answers here:
How do you synchronise projects to GitHub with Android Studio?
(13 answers)
Closed 5 years ago.
I'm using Android Studio to code my apps. Now I want to work on 2 PC's and thought about using a Cloud-Service. I decided to use GitHub, but I can't find a way to synchronize my GitHub account with my Android Studio project...
Can anyone explain this to me ?

Best way to do this is probably through the good ol' command line. First, make sure you have git installed and in your path. You can get instructions from here.
Next, go to GitHub and create a new repository with a title and such. Instructions on that here. Don't worry about creating your first commit, we're going to do that on your local machine.
Now for the fun part.
Copy the repo link of your choice (I prefer ssh, but it depends on how far you went with the set up part) and head to the terminal.
cd ~/project-path-here
git init
git add .
git commit -am "initial commit"
git remote add origin <your link>
git push -u origin master
If all has gone well, you can reload the github page and see your new push.
On your other computer, you'll be able to clone down the repo you created.
cd ~/project-path-here
git clone <your link>
You can then use git pull and git push to retrieve and send changes to the server.
You can also look into Github's desktop application if you're on Windows or Mac for a simpler time, but I find these lack some more advanced features of git.
EDIT: To register your new git repo with Android Studio, Intellij, RubyMine, etc., go to the project settings (File->Settings), search for version control, and specify that your project is using git for version control. Here for more information on that. Once that is enabled, the VCS drop down will have more features. The ones to look at are Commit Changes (git commit and push) and Update Project (git pull).

Under the VCS tab in your Studio, there's on option to publish the project to Github. Will ask for your credentials, then you're good to go to push your code.

Just getting into Android app dev and I thought I might mention here that I think that we should gitignore the build folder. It's huge and it doesn't need to be repo'd
[Edit] I'm referring to the app/build folder. And hey I see it's not included in the Android Studio .gitignore

Related

Should I check in this android folder in my react-native git repo?

I ran git status and saw the following files under android/app/ I am not sure if I need to check in these files into my git repo or not.
android/app/.gitignore
android/app/app/
android/app/gradle.properties
android/app/gradle/
android/app/gradlew
android/app/gradlew.bat
android/app/settings.gradle
Both Android and iOS folders should be committed to git.
The reason for this is that if you need to write any native code/modify xcode projects/etc, not having this information in the repo will mean that you'll need to set it up manually whenever you pull the repo to a new location. Also, this may make setting up CI such as Bitrise very difficult, as this usually relies on having a native project to build.

Import and cloning from Git to android studio

I am new in using android studio I an currently trying to build the interface between the Google Glass and computer, for that i first need to debug my glass using some sample examples from Git but i am not able to clone those examples to android studio . It says "Clone Failed" "Failed to start Git process"
I don't have enough reputation to make comments, so I'll try to provide you an answer without knowing the specifics of your setup. If this answer is misleading, please comment below and I'll try to improve it.
First make sure you have the git executable installed. Then go to the menu File->Settings. Under the section Version Control->Git, fill in the Path to Git Executable field. The exact path will depend on your system and version of git installed.

Creating Branches in Android Studio

I am new to Android Studio. I am wondering if I could create different branches to run my application. Likewise for example, if there is any possibility to have same copy of application but the difference would be just that ,one would run the production app and the other branch would run the test app.
So please suggest some method if available, to create branches or tags in Android Studio.
For this I would recoment to use gitflow here is an explanation image from nvie.com.
You can find the details in the link above. In short you use it to maintain features independed. You work on the development branch and your stable version is the master branch. So you can add fixes for the stable version without getting issues while fixing bugs with committed changes.
Back to your question how to add a branch in Android Studio click on the lower right edge in Android Studio and create that branch you want to:
If you need more information write a comment.
Create an account on github.com or bitbucket.com
then create a new repository for your project
Please read this git doc:
https://git-scm.com/book/fr/v1/D%C3%A9marrage-rapide
it's in french but there is an english version here https://git-scm.com :
in command line init git for your project:
cd ~/project-path-here
git init
git add .
git commit -am "initial commit"
git remote add origin <your link>
git push -u origin master
then manage your project with git.
You can create a branch with
git branch -checkout <new_branch_name>
Then you should be merge into your develop, release then master branch. You can use this git flow nvie.com

How to make project snapshots in android-studio

I am new to Android Studio and to Android Development as well. I am presently using version 1.3.1.
My question is how to efficiently make project "snapshots". - I am not absolutely sure the term of "snapshot" is good hence the quotes.
What I mean is to save the project as is at the moment and be able to make heavy changes without fearing to destroy what is already working well and also to be able to restart from this "snapshot" if it happens that the changes made break the project.
In other terms, how can I manage versions?
This can be achieved using a version control program such as git or svn, although git tends to be the industry standard tool.
You can follow a very simple online tutorial to get started quickly with the basics behind git. There are also a number of other excellent resources such as the git guide by Tower and the git book.
In regards to versioning, you can use git tag to tag specific versions (see docs)
#Create a new tag
git tag -a v1.0 -m 'Version 1.0'
#Create a new working branch 'version_2_dev' from v1.0
git checkout -b version_2_dev v1.0
You need to add the version control plug-ins like bitbucket, svn and git.

How to build a empty android git server?

I have a whole android project code,it is very different from google's,because a team have developed on it for one year.Now I decide to use git instead of svn.And I want to use repo script to maintain the project.How to transfer?I've try to mirror a git server from Google via
repo init -u https://android.googlesource.com/mirror/manifest --mirror
then build my branch,but when I merge my project code to it,it is too difficult.
Is there a easy way?Thanks!
I am working on this same issue, the most progress I have made is due to this google group discussion.
From what I can tell you are going to have to maintain projects individually using git (I think you can do a repo start instead of git branch to setup your branches, then when you are ready to push changes you can use git push to the mirror. The thing you can gain from the repo script is the ability to use repo sync to sync all of the projects, and repo start to make new branches.
Could you be more specific about the problem you ran into with the merge? I may be able to help more on that front.

Categories

Resources