How connect android studio to github

This article is for github beginners or for those who find it difficult to upload android projects on github.

Visit this official site to download git on your computer. Once you do that, you can start using it with android studio.

2. Enable Version Control Integration on android studio

> On doing this,you will notice that all your files will turn red.

Now ,go to VCS>Import into Version Control>Share project on Github

Now give a name to your repository and write a description if you want.

4. Push your project files on Github

Now select the files you want to share and press Ok . You can also write a specific commit message and after you do so,all your files will turn white.

Your project is now under version control and shared on Github ,you can start making changes to commit and push. You can see I added a new ImageView reference to the MainActivity.java . Notice that after I made the change, the MainActivity.java file turned blue. That means the file now has uncommitted changes (and it doesn’t match the file in the Github repository).

Its upto you now when you want to do commit and push. You can do it after every new change or after a lot of changes.

To commit and push,go to Menu>VCS(with green up arrow)

After that,you will see a commit changes window and you have to write a commit message (mandatory) and then press on commit and push.

After that,you will see another push window. Just press on push button and all your changes will be reflected in you repository.

Congratulations on setting up your first project with version control . Yayyyyy.

I am a recipitentof Udacity’s Google India challenge scholarship and I wrote this article to help my peers. Do clap if you find this useful.

Источник

How to Upload Project on GitHub from Android Studio?

Android is an operating system which is built basically for Mobile phones. It is based on the Linux Kernel and other open-source software and is developed by Google. The android app is developed on an application known as Android Studio. These executable apps are installed through a bundle or package called APK(Android Package Kit).

Git is an open-source version control system. It means that whenever a developer develops some project (like an app) or something, he/she constantly update it catering to the demands of users, technology, and whatsoever it maybe. Version control systems keep these revisions straight, storing the modifications in a central repository. It allows developers to easily collaborate, as they can download a new version of the software, make changes, and upload the newest revision. Every developer can see these new changes, download them, and contribute. Git is used to storing the source code for a project and track the complete history of all changes to that code, while GitHub is a cloud-based platform built around the Git tool. So it’s necessary to upload your android project on GitHub.

Читайте также:  Как сконектить два андроида

Before going through this article consider that one must have already a GitHub account. Also, consider that one must have already a developed android project on the android studio if not please develop this project in the android studio first How to create a COVID-19 Tracker Android App.

Step by step process to upload the Android project on GitHub from the android studio:

Step 1: Go to VCS panel which is present on the top of Android Studio and click on it. After clicking select the “Enable Version Control Integration“.

After clicking the Enable Version Control Integration a pop up will arise like following. Then select Git from the drop down menu and click OK. This will initialize the project for GitHub.

Step 2: The next step is click on the green tik present in the upper part of the Android Studio. Basically this symbol refers to Commit and what it does is it will collect the all unversioned files and make them ready to update in gitHub.

After clicking this a new screen will pop up like the following. Now, first select the unversioned files, then input the Commit message as “Initial Commit” and then click on the Commit button.

Now the project is ready to upload in GitHub.

Step 3: The last step to be followed is to go to VCS then select Import into Version Control and then click on Share project on GitHub.

After clicking this a pop up will arise where user has to enter its GitHub login id and password. After successfully logged in to its account one more pop up will come like following where the user has to give its Repository name and the Description of their repository. Then click on the share button and done.

Note: Don’t put blank spaces or special characters while giving Repository name.

Источник

How to add an Android Studio project to GitHub [duplicate]

I have a project in Android Studio. I want to add that project to a GitHub repository using android studio. How can I do that?

4 Answers 4

  1. Sign up and create a GitHub account in www.github.com.
  2. Download git from https://git-scm.com/downloads and install it in your system.
  3. Open the project in android studio and go to File -> Settings -> Version Control -> Git.
  4. Click on test button to test «path to Git executables». If successful message is shown everything is ok, else navigate to git.exe from where you installed git and test again.
  5. Go to File -> Settings -> Version Control -> GitHub. Enter your email and password used to create GitHub account and click on OK button.
  6. Then go to VCS -> Import into Version Control -> Share Project on GitHub. Enter Repository name, Description and click Share button.
  7. In the next window check all files inorder to add files for initial commit and click OK.
  8. Now the project will be uploaded to the GitHub repository and when uploading is finished we will get a message in android studio showing «Successfully shared project on GitHub». Click on the link provided in that message to go to GitHub repository.

You need to create the project on GitHub first. After that go to the project directory and run in terminal:

If you are using the latest version of Android studio, then you don’t need to install additional software for Git other than GIT itself — https://git-scm.com/downloads

  1. Create an account on Github — https://github.com/join
  2. Install Git
  3. Open your working project in Android studio
  4. GoTo — File -> Settings -> Version Controll -> GitHub
  5. Enter Login and Password which you have created just on Git Account and click on test
  6. Once all credentials are true — it shows Success message Or Invalid Cred.
  7. Now click on VCS in android studio menu bar
  8. Select Import into Version Control -> Share Project on GitHub
  9. The popup dialog that will occur contains all your files with check mark, do ok or commit all
  10. At next time whenever you want to push your project just click on VCS — > Commit Changes -> Commit and Push.
Читайте также:  Обои для андроида шахтер

That’s it. You can find your project on your GitHub now.

First of all, create a Github account and project in Github. Go to the root folder and follow steps.

The most important thing we forgot here is ignoring the file. Every time we run Gradle or build it creates new files that are changeable from build to build and pc to pc. We do not want all the files from Android Studio to be added to Git. Files like generated code, binary files (executables) should not be added to Git (version control). So please use .gitignore file while uploading projects to Github. It also reduces the size of the project uploaded to the server.

  1. Go to root folder.
  2. git init

Create .gitignore txt file in root folder. Place these content in the file. (this step not required if the file is auto-generated)

*.iml .gradle /local.properties /.idea/workspace.xml /.idea/libraries .idea .DS_Store /build /captures .externalNativeBuild

  • git add .
  • git remote add origin https://github.com/username/project.git
  • git commit — m «My First Commit»
  • git push -u origin master
  • Note : As per suggestion from different developers, they always suggest to use git from the command line. It is up to you.

    Источник

    How to connect existing Android Studio project to existing Github repository

    So I am new to Android development and Android Studio.

    I used Android Studio to create an Android project, and each time I wanted to commit the code to GitHub, I switched over to the command line and committed/pushed the code from there.

    However, I realize now that Android Studio has it’s own features for connecting to GitHub. I’d like to use those features.

    Since the project already exists, I prefer not to just create a new GitHub repository from Android Studio and delete the old one. I just want to connect the existing GitHub repository with the Android Studio project.

    How can I sync these up?

    6 Answers 6

    Maybe it is a little bit late, but if it helps to someone here is what I do in command line:

    note: if there are commits on the repo it may require you to remove conflicting files

    Connecting existing Android Studio project to existing Github repository

    If your local project is newer than the one on GitHub, then you can temporarily move it to another location, import the GitHub version into Android studio, delete these old files, and copy in the new files. Then push the changes back to GitHub. The directions to do all of this are here. This takes some command line work, but after it is set up, you can do any future commits right in Android Studio.

    Committing and pushing to GitHub from Android Studio

    After making a change, you can commit it by selecting the app folder in the Android view (or the main project folder in whatever view you are using). Then go to VCS > Git > Commit Directory. .

    Читайте также:  Web камера для планшета андроид

    Add a commit message and click Commit.

    Then go to VCS > Git > Push to push your changes to GitHub.

    I would view this thread if you want to create a new project.

    If this doesn’t help then I would just delete your current(local) project and import from github.

    I would recommend staying with command line. It is great practice. View link below for more information.

    This may help but I find it easier to the use the Git Hub desktop software which can be found here for mac: mac.github.com and here for windows: windows.github.com.

    Based on my use of the mac one.

    I was having the same issue and was looking for a solution. The answers provided on this thread are useful as git goes, but didn’t answer my question. After some tinkering around I found my own solution. I cloned the git repository that I wanted to merge my existing Android Studio Project with. I copied over the ‘.git’ folder from the cloned repository to my main Project folder for Android studio. I staged files and committed them, and pushed them to the existing git repository. Doing so updated my git repository with my existing project. I didn’t have to create a new Git repository.

    Make note that you will have to set up your «remotes» as you would have to do with command line. Your remote will be the same URL used to clone the repository.

    Warning: This not might be the answer that you are thinking of but it will surely help you get an idea of how things work around here.

    Background

    I’m also new to Android and the mentor of my course (from which I was learning Android Development) had a habit of creating new projects in Android Studio whenever a new topic started, let it be Java Basics, Intents, Fragments or backendless. I was familiar with Git and it’s working. So an idea struck in my head to create a single repository with multiple branches and keep all the projects in respective branches. Quite simple right, but things don’t work in that fashion.

    Research

    I had looked for all the answers on whatever blogs, videos or answers on StackOverflow was present and had tried all the methods. Still, I was not able to get what exactly I wanted. In the Android Studio, when we create a new project, n number of files are created, and all of them are important.

    I tried to add an existing repository into Android Studio. Firstly we cannot directly add the project into a sub-branch. Secondly, the project will not get merged, I don’t know why. Link

    I also tried to import the existing project into Android Studio. The projects will not contain all the files. Link

    Solution

    The only solution which I could find was to create a new repository every time and we can upload the changes into it. Believe me, its the best way to keep things organized. Now there comes a problem, with so many repositories, it’s hard to keep a track of all of them. So I came up with my own naming conventions for the repositories:

    — just by the name we can recognize it if we need to refer anything in future and while searching for it, they will all be in a single place

  • Android-Project- — If we are developing our app we can use this, so all projects will be present in a single place.
  • PS — I like my files to be organized in a proper hierarchy order.

    Источник

    Оцените статью