DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

In order to allow Git to use a remote repository, you have
to configure Git with some information so that it can find
it. When you use the command git clone on a
repository, Git automatically adds the remote repository
connection information via the URL entered with the
clone command.


When using the git init command, however, you need to
make sure that you enter the information to find the
remote location for the server with the git remote add
command, which has the following syntax:


git remote add (name) (url)

git remote -v can be used to show which remote
repository is configured. The following example shows
how to add a remote repository and then display what is
configured:


Click here to view code image


# git remote add origin
https://github.com/chrijack/devnetccna.git
# git remote -v
origin
https://github.com/chrijack/devnetccna.git (fetch)
origin
https://github.com/chrijack/devnetccna.git (push)

What if you make a mistake or want to remove remote
tracking of your repository? This can easily be done with
the git remote rm command, which has the following
syntax:


git remote rm (name)

Here is an example of this command in action:

Free download pdf