How to import a Project into bitbucket repository from Android Studio?
So basically I have an Android Studio project on my local computer and I need to add it into my BitBucket repository I created online. I just can't get it right with Android Studio. I can't upload files from Android Studio project to my BitBucket repository.
How can I do such a thing?
Solution 1:
Here is how I did it without plugins:
Create the repository on your Bitbucket account
Create your project in Android Studio
In Android Studio, Go to VCS
Choose 'Enable version control'
Choose Git and press OK
Right click on your project, choose Git then click Add
Open Terminal in Android Studio
Go to your Bitbucket repository Overview
Click on 'I have an existing Project'
Copy the 'git remote add origin ... etc.' line to your terminal and press enter
Click on 'Commit Changes', write your comment then press Commit and push
Also add the 'git push -u origin master' in the terminal at part 10 of above
Solution 2:
Heres is what i did without plugins
Already have a project in Android Studio
1- Create the repository on your Bitbucket account
2- In Android Studio, Go to VCS
3- Choose 'Enable version control'
4- Choose Git and press OK
5- Right click on your project, choose Git then click Add
6- Go to VCS -> Commit Changes
7- Uncheck 'Perform Code Analysis'
8- Press Commit and Push in the Commit button
9- A new window will open, on the left press the DEFINE REMOTE link
10- Go to your Bitbucket repository Overview
11- Click on 'I have an existing Project'
12- Copy the link from bitbucket to the URL tab in the Define Remote Window ,e.g. '[email protected]:username/project.git' without the 'git remote add origin...' (maybe it will ask you for a password of your bitbucket account), press Ok
13 Press Push, and it's done
Solution 3:
- In the Android studio, go to VCS-> 'Enable version control'.
From dropdown menu select Git, then click OK.
- Right click on your Project view in the Android Studio:
go to Git -> Add.
(All the files in the project should change the color, turned green probably)
- Open Terminal in the Android studio.
From your empty repo in the Bitbucket page, copy from the paragraph "Step 2: Connect your existing repository to Bitbucket" the line :
git remote add origin https://<user>@bitbucket.org/<path>.git
, then Enter.
Now type:
git commit -m "initial commit"
(to commit all the files from the Project), then Enter.
Now type:
git push -u origin master
(to push all the commited files to the master
- or the other branch, just change "master" to other branch).
That's it. Your project is versioned and placed in your Bitbucket repo.
Solution 4:
If you want to use Android studio without the use of console/terminal. Use below steps to create a new project in Bitbucket.
Go to VCS in Android Studio
Choose 'Enable version control'
Choose Git and press OK
Right click on your project, choose Git then click Add
Create the repository on your Bitbucket account
Go to your repository in Bitbucket, Copy the https url
Go to Android studio project -> Git -> Repository -> Remotes
Add a new entry with value of https link received from step 6
Android studio -> your project -> Git -> Commit Directory -> Commit & Push
Make sure you define your .ignore file to avoid unnecessary items being copied to bitbucket