Jodes Jodes - 20 days ago 4
Git Question

Where does the command `git remote add` make changes to?

When I run a command such as:

git remote add origin

Firstly, what files are being changed? Is it some file in my
directory at the base of my local tree that I cloned the repository into?

Secondly, if I then clone the repository on another machine, will that
remote add
command have been remembered? Or will it have to be run again?


The command git remote add is specifying a remote repository. This is going to be visible in the file .git/config. It will now have a line something like

[remote "origin"]
    url =
    fetch = +refs/heads/*:refs/remotes/origin/*

This will only affect your local clone.

The effect of setting a remote is when you try to do things like push, pull, and fetch. It will look at the remote repo to see if you are out of date, or to try to push your local branch up to the remote version of your branch.