How to link Android Studio to GitHub by pushing an already created project to an already created repository?

Android Studio has GitHub VCS integration. Now I have a repository that is created, but it has some test files that were made to make sure it was working. I have an android studio app project on my desktop. I am wanting to push the project to GitHub and have Android Studio be linked with GitHub so I can pull and push from within Studio.

I thought I could do this by manually pushing the project to git hub in the Git Command Line and then pulling it back down via Android Studio, however, this didn't work because when pulling back down the gradle or something didn't work and preview was lost.

So I need to be able to push the project directly to github from android studio so it works properly

1 answer

  • answered 2018-02-13 02:12 Levi Moreira

    Go to your project folder and init a git rep in there.

    git init

    Then add your github repo as the remote:

    git remote add origin <url to your github repo>

    From that onwards AS should detect the repo automatically and you'll be able to add commits and push to it.

    To add commits you right click your project and got to the Git menu. Or use the shortcuts Ctrl+K to commit and Ctrl+Shift+K to push.