Git - Managing Remotes Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Changing a remotes URL

A

git remote set-url

Changes an existing remote repository URL.

The git remote set-url command takes two arguments:

  • An existing remote name origin or upstream
  • A new URL for the remote:
    HTTPS: https://github.com/USERNAME/REPOSITORY.git
    SSH: git@github.com:USERNAME/REPOSITORY.git
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Switch remote URL from SSH to HTTPS

A

List existing remotes in order to get the name of the remote you want to change.

git remote -v

Change remotes URL from SSH to HTTPS with git remote set-url:

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

Verify that the remote URL has changed

git remote -v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Switch remote URLs from HTTPS to SSH

A

List existing remotes to get the name of remote you want to change

git remote -v

Change remotes URL from HTTPS to SSH with git remote set-url

git remote set-url origin git@github.com:USERNAME/REPOSITORY.git

Verify remote url has changed

git remote -v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a remote repository

A

Remote repositories are versions of your project that are hosted on the internet or network somewhere.
You can have several of them each of which is generally read-only or read/write.
Collaborating with others requires managing these remotes and pushing and pulling data from them when you need to share work.
Managing remotes involves: adding remotes, removing remotes, manage various remote branches, and define them as being tracked or not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To see which remote servers you have configured.

A

git remote

Lists the short names of each remote handle you’ve specified.
If you’ve cloned your repository you should at least see origin which is the default name Git gives to the server you cloned from.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Show URL git has stored for the short name.

A

git remote -v

When reading and writing to that remote.
If you have more than one remote the command line lists them all e.g. a repository with multiple remotes for working with several collaborators. (This means you can pull contributions from any of those users) you may additionally have permissions to push to one or more of these.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Adding remote repositories

A

Git clone command implicitly adds the remote origin for you.

To add a new remote git repository as a shortname you can reference easily run:

git remote add

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Pull down data from a remote project that you don’t have using
git fetch

A

git fetch

This command goes out to the remote project and pulls down all the data from the remote project that you do not have which you can merge in or inspect at any time.

Git fetch only downloads the data to your local repository — it doesn’t automatically merge it with any of your work or modify what you’re currently working on. You have to merge it manually into your work when your ready.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly