How to Connect Existing Android Studio Project to Existing Github Repository

How to connect existing Android Studio project to existing Github repository

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

How do you synchronise projects to GitHub with Android Studio?

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

http://teamtreehouse.com/library/android-tools/git/pulling-down-github-projects-to-android-studio

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

https://softwareengineering.stackexchange.com/questions/173297/why-learn-git-when-there-are-gui-apps-for-github

How to add an Android Studio project to GitHub

  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.Sample Image

Move android studio project to an already created Github Repository

The simplest way to do that is not to bring your project into an existing git repository, but to bring git to your project.

At the root of your project:

  1. git init
  2. git remote add origin <url>, where <url> is your GitHub repository's URL.
  3. git branch --set-upstream-to origin/master to setup your default branch and remote.

how to push a existing android project to an organisation's repository?

Create a new repository under your organization's account, then add it as a new remote:

git remote add newRemote https://github.com/organization/repo.git

Then, push using this command:

git push newRemote master

If you wish to make the organization's repo the default repo, you must replace the remote called origin:

git remote rm origin
git remote add origin https://github.com/organization/repo.git

You can list all currently configured remotes like so:

git remote -v

Add github project to existing Android Studio project

You have to add this:
implementation 'com.github.hakobast:dropdown-textview:0.3.1'
to build.gradle(:app) in the dependencies selection

Replace GitHub repository with a new Android Studio project while preserving old commits

  1. Rename your current project folder (the new one you want to put on GitHub) to something like MyProjectBackup.

  2. In Android Studio, go to File > New > Project from Version Control > Git. Then log in with your GitHub username and password and select your old project's repository name from the list of your GitHub repos. Continue through the import wizard and you should end up with your old project in Android Studio. (Now, for example, your old project is in MyProject and your new project is in MyProjectBackup).

  3. Manually delete everything except for .git and .gitignore (and maybe the readme and license) from your MyProject project folder. (I had tried git rm -r * but I was getting errors.)

  4. From the command line in your MyProject folder run

    git add -u
    git commit -m "deleting old files before adding updated project"

    This will update the tracked files in the working tree for all the manual deletions you just made.

  5. Copy in all your new files from MyProjectBackup. Then run

    git add .
    git commit -m "new updated project"
    git push

Now your new project will be in GitHub and the old project's commit history will still be available.

Helpful reading

  • Git Basics - Recording Changes to the Repository


Related Topics



Leave a reply



Submit