Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git how to check to which repo project is connected

How can I check to see which repo project is connected when I'm using android studio?

I have created a new repo in bitbucket, pulled that new repository and copied the old project which was connected to another repository to that folder now I want to make sure that I will push to the right repository.

like image 574
LeTadas Avatar asked Sep 25 '18 09:09

LeTadas


People also ask

How can I see which git repo is connected?

You can inspect a Git repository by using the git status command. This command allows you to see which changes have been staged, which haven't, and which files aren't being tracked by Git. You should try and remember that status output does not show you any information regarding the committed project history.

How do I know if my git remote is connected?

" git ls-remote " is the quickest way I know to test communications with a remote repository without actually cloning it. Hence its utility as a test for this issue. You can see it used for detecting an address issue in " git ls-remote returns 128 on any repo".


1 Answers

You should be able to view your remote repositories by clicking VCS > Git > Remotes.

In Android Studio you can also click the Console tab to bring up a terminal. If you have set up remote repositories, git remote -v will list them, along with their names.

To make sure you push to the right repository, just make sure you use the right repository name from this list when doing so.

Your output might be as simple as

origin  https://github.com/username/myrepo (fetch)
origin  https://github.com/username/myrepo (push)

in which case git push origin master would push to the master branch of myrepo.

If you have multiple remote repositories it might look like

origin  https://github.com/username/myrepo (fetch)
origin  https://github.com/username/myrepo (push)
repo2   https://github.com/username2/anotherrepo (fetch)
repo2   https://github.com/username2/anotherrepo (push)

in which case you can use origin or repo2 in your push command depending on where you want to commit your changes.

like image 154
samwalton Avatar answered Oct 04 '22 12:10

samwalton