Connecting to GitLab repositories on Android Studio

By | January 4, 2018

I’m trying to connect to a GitLab repository using the I/O preview of Android Studio. Does anyone know how to do this/if it is possible yet?


To clone a repo

Open a new project in Android Studio.

Click VCS -> Checkout from version control -> Git

then enter the URL of the repo and your local direcory

To commit

Open the project you want to push in Android Studio.

Click VCS -> Enable version Control -> Git

There does’t seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project add do git remote add <remote_name> <remote_url>.

Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.

See these pages for details:


How to add an Android Studio project to GitLab

This answer shows how to do it using the Android Studio GUI.

1. Create a new project on GitLab

Chose the + button on the menu bar.

enter image description here

This will give you a new project address. Choose the https version.

enter image description here

It will look something like this:

2. Create a Git repository in Android Studio

In the Android Studio menu go to VCS > Import into Version Control > Create Git Repository…

enter image description here

Select the root directory of your project. (It will be automatically selected if you already have it highlighted in the Project view. Otherwise you will have to browse up to find it.)

3. Add remote

Go to VCS > Git > Remotes…. Then paste in the https address you got from GitLab in step one.

enter image description here

4. Add, commit, and push your files

Make sure you have the top level of the project selected. If you are in the Android view you can switch it to the Project view.

enter image description here

  • Add: Go to VCS > Git > Add.

  • Commit: After adding, do VCS > Git > Commit Directory. (You will need to write a commit message, something like initial commit.)

  • Push: Finally, go to VCS > Git > Push.


You should be able to view your files in GitLab now.

See also

There is a plugin that would probably streamline the process. Check it out here.

Leave a Reply

Your email address will not be published. Required fields are marked *