Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Git how can you check which repo in Github you are pushing to from the command line?

I have several projects I am working on. I am constantly pulling and pushing. Recently I made some changes to one of my files, added and committed and decided to push my project A, however it pushed into my Github Project B. I then did git pull for kicks and it this happened.

  • branch master -> FETCH_HEAD Already up-to-date.

It did not pull none of my files from Project B. I then did git status and it showed every single file/folders in my directory as needing to be committed. How would I know which "init" I am on? How can I switch out of this state and how can I disregard these blind commits without losing my files?

like image 402
V.Villacis Avatar asked Nov 22 '15 01:11

V.Villacis


People also ask

How do I know which git repository I am on?

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.

How does git know which repository to push to?

git directory that contains metadata about the repository. That's what Git uses to determine where to push your changes.

How do I access my GitHub repository from command line?

Open a command prompt. To launch GitHub Desktop to the last opened repository, type github . To launch GitHub Desktop for a particular repository, type github followed by the path to the repository. You can also change to your repository path and then type github . to open that repository.

How do I push to a specific repo on GitHub?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.


2 Answers

I think you need to reconfig git remote

type git remote -v and see if there's a mismatch or not.
If there is, follow this instruction from github: https://help.github.com/articles/changing-a-remote-s-url/

like image 134
TLJ Avatar answered Oct 14 '22 00:10

TLJ


You can check the configs of your repository by :

git config -l 

which contains your remote repository url.

Also, you can use the following command :

git remote -v 
like image 20
Farhad Faghihi Avatar answered Oct 13 '22 23:10

Farhad Faghihi