Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pull from another computer's repository in Git?

Tags:

git

git-pull

For example, I have cloned the origin repository on two computers. Then, I go ahead and make some changes and commit to the local repository of computer A. How do I now pull these changes to computer B? Both computer A and B are connected to a network.

What I am looking for will be the equivalent of someone manually creating a patch and sending it to me, which I can apply to my working copy/local repo.

like image 588
jeffreyveon Avatar asked Nov 09 '10 06:11

jeffreyveon


People also ask

How do I access my git repository on another computer?

in CMD go to folder where you want your app to be cloned to, for example cd C:/my_apps/ login to github and go to app you want to clone, press green button "Clone or Download", you will see SSH link, copy it. in CMD run git clone [email protected]:user/my-app. git (use SSH link you copied)

How do I pull a remote git repository?

The content of the multiple remote repositories can be pulled to the local drive by using the command, `git pull origin` or `git pull upstream`.

How do I pull changes from a cloned repository?

To pull down (i.e. copy) the changes merged into your fork, you can use the Terminal and the git pull command. To begin: On your local computer, navigate to your forked repo directory. Once you have changed directories to the forked repo directory, run the command git pull .


1 Answers

If the machine you want to pull from is accessible via ssh, you can add the repository on it as a remote via ssh, and then pull from it like you would any remote:

$ git remote add repo_b username@host:path/to/repository.git $ git pull repo_b master 

(You can skip the step of adding a remote and just specify the full URL in the git pull command instead of a remote name, but if you're going to be pulling from the repository on a regular basis, adding it as a remote will save you lots of typing.)

like image 104
Amber Avatar answered Sep 23 '22 01:09

Amber