Wickerman
Wickerman

Reputation: 417

Android Studio: push to GitHub repository

I want to be able to use the GitHub integration in Android Studios. I've made a project and I've done all the login-stuff you need to do in order to connect to your GitHub-account.

In Android Studios, I click on VCS -> Import Into Version Control -> Share Project on GitHub.

Following question comes up:
Project is already on GitHub
Can't connect to repository from configured remote. You could want to check .git config. Do you want to proceed anyway?

If I click 'Yes', I can continue to fill in a new repository and description.

I get the following warning:
"Can't add remote fatal: remote github already exists. during executing git -c core.quotepath=false remote add github https://github.com/Wickerman2/Test2.git"

But I don't have any repositories! Android Studios only creates the repository Test2 and won't push any files!

Upvotes: 2

Views: 15676

Answers (2)

Durican Radu
Durican Radu

Reputation: 1337

The cleanest way to do it is the following:

  1. Make directory anywhere in your computer
  2. Change to that specific directory
  3. List item Git Clone that project that is already on github git clone [email protected]:foobar
  4. Copy-Paste your Android Studio project there

Now you should be able to use the version control.

Upvotes: 1

piotrek1543
piotrek1543

Reputation: 19351

It seems to be that you created a remote repository before you wanted to share it on Github.

I see two ways:

  1. Push changed code to your existing repo choosing VCS -> Git -> Push
  2. Delete existing remote repo and try again to Share a project
  3. Close Android Studio. Download an existing GitHub project (you can download as zip and than unpack it), put it anywhere. Go to this folder, it seems to be an empty but it has already hidden .git folder. On Linux press Ctrl+H to show hidden files and copy this folder to your project. At this time, just commit changes and push it to remote repository.

Show hidden files on Windows: http://www.technipages.com/show-hidden-files-windows

If you would like to learn a bit Git console, visit: https://try.github.io/levels/1/challenges/1

Already I more times use console than Android Studio Github Integration, cause the second ones sometimes freezes and cannot force some actions.

Upvotes: 3

Related Questions