Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change git repository using android studio

I'm using git with android studio and I already sync other repository.

But I hope to change a git repository like github.

I think I need to disconnect already connected to the repository but I don't found this option.

To do that, How can I do?

like image 373
JayD Avatar asked Jun 02 '15 02:06

JayD


People also ask

How do I switch between Git repositories?

“git how to switch to another repository” Code Answer's Create a new repo at github. Clone the repo from fedorahosted to your local machine. Now you can work with it just like any other github repo. simply run git pull upstream master && git push origin master.

How do I find my Git repository url Android Studio?

You can view the remote links in Android Studio as: In menu, click VCS => git => remotes.


Video Answer


2 Answers

We can change the repository url. Just follow the steps.

In Android Studio Arctic Fox | 2020.3.1

  1. Right click on project folder
  2. From menu Choose “Git”
  3. Then chosse "Manage Remotes..."
  4. Now, select the existing "origin" and click on edit
  5. Enter your new URL and click OK

For Android Studio Older versions

  1. Right click on project folder
  2. From menu Choose “Git
  3. Choose “Repository
  4. Choose “Remotes…”

Git > Repository > Remotes...

  1. Now you got the “Git Remotes” popup

Git Remotes

  1. You can edit the existing url or remove the old url and then add new url.
  2. Click “OK”. that’s it. Now you are connected with new repo. But branches are not connected. Just follow few steps to complete.
  3. Try to pull the changes from repo “Git > Repository > Pull…
  4. Now you got the “Pull Changes” popup. Click “Refresh” button.

Pull Changes

  1. After successfully reconnected with repo then you can see the branches of new repo under “Branches to merge” box.

Branches to merge

  1. Done. Now you are connected with new repo & branches.

Happy Coding :)

like image 99
Divakar Murugesh Avatar answered Sep 22 '22 11:09

Divakar Murugesh


You can use SmartGit application and set your new git url at "Remote\Properties..." and then push button "Store".

Or you can go to "[project folder]\.git" and edit "config" file. Find line "url = https//[your current url]" and put your new url instead.

like image 27
Evgeny Sinitsky Avatar answered Sep 23 '22 11:09

Evgeny Sinitsky