Restructure and move Git content (#18336)
* Rename map topic * Delete map topic * Rename map topic * Add redirect * Remove last two map topics * Move article on adding a remote into a long-form guide * Move article on changing a remote's URL * Move articles on renaming and removing remotes * Move remote URL article * Fix typo * Remove category index file * Move a few articles to the new category * Move a few more files * Move managing remote repos article * Move the rest of the getting started with git map topic * Move the first half of the using git map topic * Move the rest of the articles and 🔥 the directory * Fix failing test * Remove Using Git from product index * Apply suggestions from code review Co-authored-by: Laura Coursen <lecoursen@github.com> * Apply suggestions from code review Co-authored-by: Laura Coursen <lecoursen@github.com>
This commit is contained in:
@@ -25,7 +25,7 @@ In addition to redirecting web traffic, all `git clone`, `git fetch`, or `git pu
|
||||
$ git remote set-url origin <em>new_url</em>
|
||||
```
|
||||
|
||||
For more information, see "[Changing a Remote's URL](/github/using-git/changing-a-remotes-url)."
|
||||
For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ When you transfer a repository, its issues, pull requests, wiki, stars, and watc
|
||||
$ git remote set-url origin <em>new_url</em>
|
||||
```
|
||||
|
||||
For more information, see "[Changing a remote's URL](/articles/changing-a-remote-s-url)".
|
||||
For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
#### Repository transfers and organizations
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ After you enable required status checks, your branch may need to be up-to-date w
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** You can also bring your branch up to date with the base branch using Git rebase. For more information, see "[About Git rebase](/github/using-git/about-git-rebase)."
|
||||
**Note:** You can also bring your branch up to date with the base branch using Git rebase. For more information, see "[About Git rebase](/github/getting-started-with-github/about-git-rebase)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ You can authenticate with the API in different ways.
|
||||
|
||||
### Authenticating with the command line
|
||||
|
||||
You can access repositories on {% data variables.product.product_name %} from the command line in two ways, HTTPS and SSH, and both have a different way of authenticating. The method of authenticating is determined based on whether you choose an HTTPS or SSH remote URL when you clone the repository. For more information about which way to access, see "[Which remote URL should I use?](/github/using-git/which-remote-url-should-i-use)"
|
||||
You can access repositories on {% data variables.product.product_name %} from the command line in two ways, HTTPS and SSH, and both have a different way of authenticating. The method of authenticating is determined based on whether you choose an HTTPS or SSH remote URL when you clone the repository. For more information about which way to access, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
|
||||
* You can work with all repositories on {% data variables.product.product_name %} over HTTPS, even if you are behind a firewall or proxy. Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your credentials to authenticate with {% data variables.product.product_name %}, unless you cache them with a [credential helper](/github/using-git/caching-your-github-credentials-in-git). {% data reusables.user_settings.password-authentication-deprecation %}
|
||||
* You can work with all repositories on {% data variables.product.product_name %} over HTTPS, even if you are behind a firewall or proxy. Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your credentials to authenticate with {% data variables.product.product_name %}, unless you cache them with a [credential helper](/github/getting-started-with-github/caching-your-github-credentials-in-git). {% data reusables.user_settings.password-authentication-deprecation %}
|
||||
|
||||
* You can work with all repositories on {% data variables.product.product_name %} over SSH, although firewalls and proxys might refuse to allow SSH connections. Using SSH requires you to generate an SSH public/private keypair on your local machine and add the public key to your {% data variables.product.product_name %} account. Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your SSH key passphrase, unless you've [stored the key](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent). For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)."
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Before adding a new SSH key to your {% data variables.product.product_name %} ac
|
||||
* [Checked for existing SSH keys](/articles/checking-for-existing-ssh-keys)
|
||||
* [Generated a new SSH key and added it to the ssh-agent](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
|
||||
|
||||
After adding a new SSH key to your {% data variables.product.product_name %} account, you can reconfigure any local repositories to use SSH. For more information, see "[Switching remote URLs from HTTPS to SSH](/articles/changing-a-remote-s-url/#switching-remote-urls-from-https-to-ssh)."
|
||||
After adding a new SSH key to your {% data variables.product.product_name %} account, you can reconfigure any local repositories to use SSH. For more information, see "[Switching remote URLs from HTTPS to SSH](/github/getting-started-with-github/managing-remote-repositories/#switching-remote-urls-from-https-to-ssh)."
|
||||
|
||||
{% data reusables.ssh.dsa-support %}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ Personal access tokens (PATs) are an alternative to using passwords for authenti
|
||||
|
||||
{% data reusables.command_line.providing-token-as-password %}
|
||||
|
||||
Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to [switch the remote from SSH to HTTPS](/articles/changing-a-remote-s-url/#switching-remote-urls-from-ssh-to-https).
|
||||
Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to [switch the remote from SSH to HTTPS](/github/getting-started-with-github/managing-remote-repositories/#switching-remote-urls-from-ssh-to-https).
|
||||
|
||||
If you are not prompted for your username and password, your credentials may be cached on your computer. You can [update your credentials in the Keychain](/articles/updating-credentials-from-the-osx-keychain) to replace your old password with the token.
|
||||
|
||||
|
||||
@@ -30,5 +30,5 @@ You can only use your password to log on to {% data variables.product.product_na
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Caching your {% data variables.product.product_name %} credentials in Git](/github/using-git/caching-your-github-credentials-in-git/)"
|
||||
- "[Caching your {% data variables.product.product_name %} credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git/)"
|
||||
- "[Keeping your account and data secure](/articles/keeping-your-account-and-data-secure/)"
|
||||
|
||||
@@ -26,7 +26,7 @@ $ ssh -vT git@{% data variables.command_line.codeblock %}
|
||||
|
||||
#### Use HTTPS
|
||||
|
||||
Often, the simplest solution is to simply avoid SSH entirely. Most firewalls and proxies allow HTTPS traffic without issue. To take advantage of this, change [the remote URL](/articles/which-remote-url-should-i-use) you're using:
|
||||
Often, the simplest solution is to simply avoid SSH entirely. Most firewalls and proxies allow HTTPS traffic without issue. To take advantage of this, change [the remote URL](/github/getting-started-with-github/about-remote-repositories) you're using:
|
||||
|
||||
```shell
|
||||
$ git clone https://{% data variables.command_line.codeblock %}/<em>username</em>/<em>reponame</em>.git
|
||||
|
||||
@@ -40,7 +40,7 @@ All connections, including those for remote URLs, must be made as the "git" user
|
||||
$ ssh -T <em>GITHUB-USERNAME</em>@{% data variables.command_line.codeblock %}
|
||||
> Permission denied (publickey).
|
||||
```
|
||||
If your connection failed and you're using a remote URL with your {% data variables.product.product_name %} username, you can [change the remote URL to use the "git" user](/articles/changing-a-remote-s-url/).
|
||||
If your connection failed and you're using a remote URL with your {% data variables.product.product_name %} username, you can [change the remote URL to use the "git" user](/github/getting-started-with-github/managing-remote-repositories).
|
||||
|
||||
You should verify your connection by typing:
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ If you [configured your SSH passphrase with the OS X Keychain](/articles/working
|
||||
|
||||
{% windows %}
|
||||
|
||||
If you lose your SSH key passphrase, there's no way to recover it. You'll need to [generate a brand new SSH keypair](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [switch to HTTPS cloning](/articles/changing-a-remote-s-url/#switching-remote-urls-from-ssh-to-https) so you can use your GitHub password instead.
|
||||
If you lose your SSH key passphrase, there's no way to recover it. You'll need to [generate a brand new SSH keypair](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [switch to HTTPS cloning](/github/getting-started-with-github/managing-remote-repositories) so you can use your GitHub password instead.
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
{% linux %}
|
||||
|
||||
If you lose your SSH key passphrase, there's no way to recover it. You'll need to [generate a brand new SSH keypair](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [switch to HTTPS cloning](/articles/which-remote-url-should-i-use/#cloning-with-https-urls) so you can use your GitHub password instead.
|
||||
If you lose your SSH key passphrase, there's no way to recover it. You'll need to [generate a brand new SSH keypair](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or [switch to HTTPS cloning](/github/getting-started-with-github/about-remote-repositories/#cloning-with-https-urls) so you can use your GitHub password instead.
|
||||
|
||||
{% endlinux %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Using SSH over the HTTPS port
|
||||
intro: 'Sometimes, firewalls refuse to allow SSH connections entirely. If using [HTTPS cloning with credential caching](/github/using-git/caching-your-github-credentials-in-git) is not an option, you can attempt to clone using an SSH connection made over the HTTPS port. Most firewall rules should allow this, but proxy servers may interfere.'
|
||||
intro: 'Sometimes, firewalls refuse to allow SSH connections entirely. If using [HTTPS cloning with credential caching](/github/getting-started-with-github/caching-your-github-credentials-in-git) is not an option, you can attempt to clone using an SSH connection made over the HTTPS port. Most firewall rules should allow this, but proxy servers may interfere.'
|
||||
redirect_from:
|
||||
- /articles/using-ssh-over-the-https-port
|
||||
versions:
|
||||
|
||||
@@ -70,7 +70,7 @@ For example, if you and another person both edited the file _styleguide.md_ on t
|
||||
$ git commit -m "Resolved merge conflict by incorporating both suggestions."
|
||||
```
|
||||
|
||||
You can now merge the branches on the command line or [push your changes to your remote repository](/articles/pushing-commits-to-a-remote-repository/) on {% data variables.product.product_name %} and [merge your changes](/articles/merging-a-pull-request/) in a pull request.
|
||||
You can now merge the branches on the command line or [push your changes to your remote repository](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) on {% data variables.product.product_name %} and [merge your changes](/articles/merging-a-pull-request/) in a pull request.
|
||||
|
||||
### Removed file merge conflicts
|
||||
|
||||
@@ -119,7 +119,7 @@ For example, if you edited a file, such as *README.md*, and another person remov
|
||||
> [branch-d 6f89e49] Merge branch 'branch-c' into branch-d
|
||||
```
|
||||
|
||||
You can now merge the branches on the command line or [push your changes to your remote repository](/articles/pushing-commits-to-a-remote-repository/) on {% data variables.product.product_name %} and [merge your changes](/articles/merging-a-pull-request/) in a pull request.
|
||||
You can now merge the branches on the command line or [push your changes to your remote repository](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) on {% data variables.product.product_name %} and [merge your changes](/articles/merging-a-pull-request/) in a pull request.
|
||||
|
||||
### Further reading
|
||||
|
||||
|
||||
@@ -51,6 +51,6 @@ Before you can sync your fork with an upstream repository, you must [configure a
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip**: Syncing your fork only updates your local copy of the repository. To update your fork on {% data variables.product.product_location %}, you must [push your changes](/articles/pushing-commits-to-a-remote-repository/).
|
||||
**Tip**: Syncing your fork only updates your local copy of the repository. To update your fork on {% data variables.product.product_location %}, you must [push your changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/).
|
||||
|
||||
{% endtip %}
|
||||
|
||||
@@ -19,7 +19,7 @@ You can add a co-author on any commits you collaborate on. For more information,
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
You can also create a commit on behalf of an organization. For more information, see "[Creating a commit on behalf of an organization](/github/committing-changes-to-your-project/creating-a-commit-on-behalf-of-an-organization)."{% endif %}
|
||||
|
||||
Rebasing allows you to change a series of commits and can modify the order of the commits in your timeline. For more information, see "[About git rebase](/github/using-git/about-git-rebase)."
|
||||
Rebasing allows you to change a series of commits and can modify the order of the commits in your timeline. For more information, see "[About git rebase](/github/getting-started-with-github/about-git-rebase)."
|
||||
|
||||
### Further reading
|
||||
- "[Committing and reviewing changes to your project](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project#about-commits)" on {% data variables.product.prodname_desktop %}
|
||||
|
||||
@@ -47,7 +47,7 @@ Organization's can use the `name@organization.com` email as a public point of co
|
||||
on-behalf-of: <em>@org</em> <<em>name@organization.com</em>>"
|
||||
```
|
||||
|
||||
The new commit, message, and badge will appear on {% data variables.product.product_location %} the next time you push. For more information, see "[Pushing changes to a remote repository](/articles/pushing-commits-to-a-remote-repository/)."
|
||||
The new commit, message, and badge will appear on {% data variables.product.product_location %} the next time you push. For more information, see "[Pushing changes to a remote repository](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/)."
|
||||
|
||||
### Creating commits with an `on-behalf-of` badge on {% data variables.product.product_name %}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ You can use {% data variables.product.prodname_desktop %} to create a commit wit
|
||||
Co-authored-by: <em>another-name</em> <<em>another-name@example.com</em>>"
|
||||
```
|
||||
|
||||
The new commit and message will appear on {% data variables.product.product_location %} the next time you push. For more information, see "[Pushing changes to a remote repository](/articles/pushing-commits-to-a-remote-repository/)."
|
||||
The new commit and message will appear on {% data variables.product.product_location %} the next time you push. For more information, see "[Pushing changes to a remote repository](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/)."
|
||||
|
||||
### Creating co-authored commits on {% data variables.product.product_name %}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ topics:
|
||||
|
||||
You can clone a repository from {% data variables.product.product_location %} to your local computer to make it easier to fix merge conflicts, add or remove files, and push larger commits. When you clone a repository, you copy the repository from {% data variables.product.product_location %} to your local machine.
|
||||
|
||||
Cloning a repository pulls down a full copy of all the repository data that {% data variables.product.product_location %} has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on {% data variables.product.product_location %}, or pull other people's changes from {% data variables.product.product_location %}. For more information, see "[Using common Git commands](/github/using-git/using-common-git-commands)".
|
||||
Cloning a repository pulls down a full copy of all the repository data that {% data variables.product.product_location %} has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on {% data variables.product.product_location %}, or pull other people's changes from {% data variables.product.product_location %}. For more information, see "[Using Git](/github/getting-started-with-github/using-git)".
|
||||
|
||||
You can clone your existing repository or clone another person's existing repository to contribute to a project.
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ topics:
|
||||
{% data reusables.repositories.choose-repo-visibility %}
|
||||
6. If you're not using a template, there are a number of optional items you can pre-populate your repository with. If you're importing an existing repository to {% data variables.product.product_name %}, don't choose any of these options, as you may introduce a merge conflict. You can add or create new files using the user interface or choose to add new files using the command line later. For more information, see "[Importing a Git repository using the command line](/articles/importing-a-git-repository-using-the-command-line/)," "[Adding a file to a repository using the command line](/articles/adding-a-file-to-a-repository-using-the-command-line)," and "[Addressing merge conflicts](/articles/addressing-merge-conflicts/)."
|
||||
- You can create a README, which is a document describing your project. For more information, see "[About READMEs](/articles/about-readmes/)."
|
||||
- You can create a *.gitignore* file, which is a set of ignore rules. For more information, see "[Ignoring files](/articles/ignoring-files)."{% if currentVersion == "free-pro-team@latest" %}
|
||||
- You can create a *.gitignore* file, which is a set of ignore rules. For more information, see "[Ignoring files](/github/getting-started-with-github/ignoring-files)."{% if currentVersion == "free-pro-team@latest" %}
|
||||
- You can choose to add a software license for your project. For more information, see "[Licensing a repository](/articles/licensing-a-repository)."{% endif %}
|
||||
{% data reusables.repositories.select-marketplace-apps %}
|
||||
{% data reusables.repositories.create-repo %}
|
||||
|
||||
@@ -17,7 +17,7 @@ Typos happen, and repository names are case-sensitive. If you try to clone `git
|
||||
|
||||
To avoid this error, when cloning, always copy and paste the clone URL from the repository's page. For more information, see "[Cloning a repository](/articles/cloning-a-repository)."
|
||||
|
||||
To update the remote on an existing repository, see "[Changing a remote's URL](/articles/changing-a-remote-s-url)".
|
||||
To update the remote on an existing repository, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)".
|
||||
|
||||
### Checking your permissions
|
||||
|
||||
|
||||
@@ -75,10 +75,10 @@ When prompted for a username and password, make sure you use an account that has
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip**: If you don't want to enter your credentials every time you interact with the remote repository, you can turn on [credential caching](/github/using-git/caching-your-github-credentials-in-git). If you are already using credential caching, please make sure that your computer has the correct credentials cached. Incorrect or out of date credentials will cause authentication to fail.
|
||||
**Tip**: If you don't want to enter your credentials every time you interact with the remote repository, you can turn on [credential caching](/github/getting-started-with-github/caching-your-github-credentials-in-git). If you are already using credential caching, please make sure that your computer has the correct credentials cached. Incorrect or out of date credentials will cause authentication to fail.
|
||||
|
||||
{% endtip %}
|
||||
|
||||
### Use SSH instead
|
||||
|
||||
If you've previously set up SSH keys, you can use the SSH clone URL instead of HTTPS. For more information, see "[Which remote URL should I use?](/articles/which-remote-url-should-i-use)"
|
||||
If you've previously set up SSH keys, you can use the SSH clone URL instead of HTTPS. For more information, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
|
||||
@@ -33,7 +33,7 @@ Create a personal access token on your application settings page. For more infor
|
||||
|
||||
{% data reusables.command_line.providing-token-as-password %}
|
||||
|
||||
To avoid these prompts, you can use Git password caching. For information, see "[Caching your GitHub credentials in Git](/github/using-git/caching-your-github-credentials-in-git)."
|
||||
To avoid these prompts, you can use Git password caching. For information, see "[Caching your GitHub credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git)."
|
||||
|
||||
{% warning %}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ redirect_from:
|
||||
- /rebase/
|
||||
- articles/interactive-rebase/
|
||||
- /articles/about-git-rebase
|
||||
- /github/using-git/about-git-rebase
|
||||
intro: 'The `git rebase` command allows you to easily change a series of commits, modifying the history of your repository. You can reorder, edit, or squash commits together.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -67,7 +68,7 @@ There are six commands available while rebasing:
|
||||
|
||||
### An example of using `git rebase`
|
||||
|
||||
No matter which command you use, Git will launch [your default text editor](/articles/associating-text-editors-with-git) and open a file that details the commits in the range you've chosen. That file looks something like this:
|
||||
No matter which command you use, Git will launch [your default text editor](/github/getting-started-with-github/associating-text-editors-with-git) and open a file that details the commits in the range you've chosen. That file looks something like this:
|
||||
|
||||
```
|
||||
pick 1fc6c95 Patch A
|
||||
@@ -4,6 +4,7 @@ redirect_from:
|
||||
- /articles/working-with-subtree-merge/
|
||||
- /subtree-merge/
|
||||
- /articles/about-git-subtree-merges
|
||||
- /github/using-git/about-git-subtree-merges
|
||||
intro: 'If you need to manage multiple projects within a single repository, you can use a *subtree merge* to handle all the references.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -85,7 +86,7 @@ Although we've only added one subproject, any number of subprojects can be incor
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip**: If you create a fresh clone of the repository in the future, the remotes you've added will not be created for you. You will have to add them again using [the `git remote add` command](/articles/adding-a-remote).
|
||||
**Tip**: If you create a fresh clone of the repository in the future, the remotes you've added will not be created for you. You will have to add them again using [the `git remote add` command](/github/getting-started-with-github/managing-remote-repositories).
|
||||
|
||||
{% endtip %}
|
||||
|
||||
@@ -1,18 +1,51 @@
|
||||
---
|
||||
title: Which remote URL should I use?
|
||||
title: About remote repositories
|
||||
redirect_from:
|
||||
- /articles/working-when-github-goes-down/
|
||||
- /articles/sharing-repositories-without-github/
|
||||
- /articles/about-remote-repositories
|
||||
- /articles/which-url-should-i-use/
|
||||
- /articles/which-remote-url-should-i-use
|
||||
intro: 'There are several ways to clone repositories available on {% data variables.product.product_location %}.'
|
||||
- /github/using-git/which-remote-url-should-i-use
|
||||
- /github/using-git/about-remote-repositories
|
||||
intro: 'GitHub''s collaborative approach to development depends on publishing commits from your local repository to {% data variables.product.product_name %} for other people to view, fetch, and update.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
When you view a repository while signed in to your account, the URLs you can use to clone the project onto your computer are available below the repository details:
|
||||
### About remote repositories
|
||||
|
||||
For information on setting or changing your remote URL, see "[Changing a remote's URL](/articles/changing-a-remote-s-url)."
|
||||
A remote URL is Git's fancy way of saying "the place where your code is stored." That URL could be your repository on GitHub, or another user's fork, or even on a completely different server.
|
||||
|
||||
You can only push to two types of URL addresses:
|
||||
|
||||
* An HTTPS URL like `https://{% data variables.command_line.backticks %}/user/repo.git`
|
||||
* An SSH URL, like `git@{% data variables.command_line.backticks %}:user/repo.git`
|
||||
|
||||
Git associates a remote URL with a name, and your default remote is usually called `origin`.
|
||||
|
||||
### Creating remote repositories
|
||||
|
||||
You can use the `git remote add` command to match a remote URL with a name.
|
||||
For example, you'd type the following in the command line:
|
||||
|
||||
```shell
|
||||
git remote add origin <em> <REMOTE_URL> </em>
|
||||
```
|
||||
|
||||
This associates the name `origin` with the `REMOTE_URL`.
|
||||
|
||||
You can use the command `git remote set-url` to [change a remote's URL](/github/getting-started-with-github/managing-remote-repositories).
|
||||
|
||||
### Choosing a URL for your remote repository
|
||||
|
||||
There are several ways to clone repositories available on {% data variables.product.product_location %}.
|
||||
|
||||
When you view a repository while signed in to your account, the URLs you can use to clone the project onto your computer are available below the repository details.
|
||||
|
||||
For information on setting or changing your remote URL, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
### Cloning with HTTPS URLs
|
||||
|
||||
@@ -25,9 +58,7 @@ When you `git clone`, `git fetch`, `git pull`, or `git push` to a remote reposit
|
||||
{% tip %}
|
||||
|
||||
**Tips**:
|
||||
|
||||
- You can use a credential helper so Git will remember your {% data variables.product.prodname_dotcom %} credentials every time it talks to {% data variables.product.prodname_dotcom %}. For more information, see "[Caching your {% data variables.product.prodname_dotcom %} credentials in Git](/github/using-git/caching-your-github-credentials-in-git)."
|
||||
|
||||
- You can use a credential helper so Git will remember your {% data variables.product.prodname_dotcom %} credentials every time it talks to {% data variables.product.prodname_dotcom %}. For more information, see "[Caching your {% data variables.product.prodname_dotcom %} credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git)."
|
||||
- To clone a repository without authenticating to {% data variables.product.product_name %} on the command line, you can use {% data variables.product.prodname_desktop %} to clone instead. For more information, see "[Cloning a repository from {% data variables.product.prodname_dotcom %} to {% data variables.product.prodname_dotcom %} Desktop](/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop)."
|
||||
|
||||
{% endtip %}
|
||||
@@ -63,7 +94,3 @@ You can also use a [Subversion](https://subversion.apache.org/) client to access
|
||||
|
||||
You can also access repositories on {% data variables.product.prodname_dotcom %} from Subversion clients. For more information, see "[Support for Subversion clients](/github/importing-your-projects-to-github/support-for-subversion-clients)."
|
||||
{% endif %}
|
||||
|
||||
### Further reading
|
||||
|
||||
- [Working with Remotes](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes) from the _Pro Git_ book site
|
||||
@@ -6,6 +6,7 @@ redirect_from:
|
||||
- /articles/using-textmate-as-your-default-editor/
|
||||
- /articles/using-sublime-text-2-as-your-default-editor/
|
||||
- /articles/associating-text-editors-with-git
|
||||
- /github/using-git/associating-text-editors-with-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -4,7 +4,8 @@ redirect_from:
|
||||
- /firewalls-and-proxies/
|
||||
- /articles/caching-your-github-password-in-git
|
||||
- /github/using-git/caching-your-github-password-in-git
|
||||
intro: 'If you''re [cloning {% data variables.product.product_name %} repositories using HTTPS](/github/using-git/which-remote-url-should-i-use), you can use a credential helper to tell Git to remember your credentials.'
|
||||
- /github/using-git/caching-your-github-credentials-in-git
|
||||
intro: 'If you''re [cloning {% data variables.product.product_name %} repositories using HTTPS](/github/getting-started-with-github/about-remote-repositories), you can use a credential helper to tell Git to remember your credentials.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -6,6 +6,7 @@ redirect_from:
|
||||
- /line-endings/
|
||||
- /articles/dealing-with-line-endings/
|
||||
- /articles/configuring-git-to-handle-line-endings
|
||||
- /github/using-git/configuring-git-to-handle-line-endings
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -3,6 +3,7 @@ title: Dealing with non-fast-forward errors
|
||||
intro: 'Sometimes, Git can''t make your change to a remote repository without losing commits. When this happens, your push is refused.'
|
||||
redirect_from:
|
||||
- /articles/dealing-with-non-fast-forward-errors
|
||||
- /github/using-git/dealing-with-non-fast-forward-errors
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -21,7 +22,7 @@ $ git push origin main
|
||||
> 'Note about fast-forwards' section of 'git push --help' for details.
|
||||
```
|
||||
|
||||
You can fix this by [fetching and merging](/articles/getting-changes-from-a-remote-repository) the changes made on the remote branch with the changes that you have made locally:
|
||||
You can fix this by [fetching and merging](/github/getting-started-with-github/getting-changes-from-a-remote-repository) the changes made on the remote branch with the changes that you have made locally:
|
||||
|
||||
```shell
|
||||
$ git fetch origin
|
||||
@@ -4,12 +4,13 @@ intro: You can use common Git commands to access remote repositories.
|
||||
redirect_from:
|
||||
- /articles/fetching-a-remote/
|
||||
- /articles/getting-changes-from-a-remote-repository
|
||||
- /github/using-git/getting-changes-from-a-remote-repository
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
These commands are very useful when interacting with [a remote repository](/articles/about-remote-repositories). `clone` and `fetch` download remote code from a repository's remote URL to your local computer, `merge` is used to merge different people's work together with yours, and `pull` is a combination of `fetch` and `merge`.
|
||||
These commands are very useful when interacting with [a remote repository](/github/getting-started-with-github/about-remote-repositories). `clone` and `fetch` download remote code from a repository's remote URL to your local computer, `merge` is used to merge different people's work together with yours, and `pull` is a combination of `fetch` and `merge`.
|
||||
|
||||
### Cloning a repository
|
||||
|
||||
@@ -20,7 +21,7 @@ $ git clone https://{% data variables.command_line.codeblock %}/<em>USERNAME</em
|
||||
# Clones a repository to your computer
|
||||
```
|
||||
|
||||
You can choose from [several different URLs](/articles/which-remote-url-should-i-use) when cloning a repository. While logged in to {% data variables.product.prodname_dotcom %}, these URLs are available below the repository details:
|
||||
You can choose from [several different URLs](/github/getting-started-with-github/about-remote-repositories) when cloning a repository. While logged in to {% data variables.product.prodname_dotcom %}, these URLs are available below the repository details:
|
||||
|
||||

|
||||
|
||||
@@ -39,15 +40,14 @@ such remote-tracking branch names to `origin/foo`.
|
||||
|
||||
Use `git fetch` to retrieve new work done by other people. Fetching from a repository grabs all the new remote-tracking branches and tags *without* merging those changes into your own branches.
|
||||
|
||||
If you already have a local repository [with a remote URL](/articles/adding-a-remote) set up for the desired project, you can grab all the new information by using `git fetch *remotename*` in the terminal:
|
||||
If you already have a local repository with a remote URL set up for the desired project, you can grab all the new information by using `git fetch *remotename*` in the terminal:
|
||||
|
||||
```shell
|
||||
$ git fetch <em>remotename</em>
|
||||
# Fetches updates made to a remote repository
|
||||
```
|
||||
|
||||
Otherwise, you can always [add a new remote](/articles/adding-a-remote)
|
||||
and then fetch.
|
||||
Otherwise, you can always add a new remote and then fetch. For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
### Merging changes into your local branch
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
---
|
||||
title: Getting started with Git and GitHub
|
||||
title: Getting started with Git
|
||||
intro: ''
|
||||
mapTopic: true
|
||||
redirect_from:
|
||||
- /articles/getting-started-with-git-and-github
|
||||
- /github/using-git/getting-started-with-git-and-github
|
||||
- /github/using-git/learning-about-git
|
||||
- /articles/learning-about-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -4,6 +4,7 @@ intro: '{% data variables.product.prodname_dotcom %} flow is a lightweight, bran
|
||||
redirect_from:
|
||||
- /articles/what-is-a-good-git-workflow/
|
||||
- /articles/git-workflows
|
||||
- /github/using-git/git-workflows
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -4,6 +4,7 @@ redirect_from:
|
||||
- /git-ignore/
|
||||
- /ignore-files/
|
||||
- /articles/ignoring-files
|
||||
- /github/using-git/ignoring-files
|
||||
intro: 'You can configure Git to ignore files you don''t want to check in to {% data variables.product.product_name %}.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -12,6 +12,9 @@ redirect_from:
|
||||
- /categories/53/articles/
|
||||
- /categories/setup/
|
||||
- /categories/getting-started-with-github
|
||||
- /categories/19/articles/
|
||||
- /categories/using-git
|
||||
- /github/using-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -68,7 +71,6 @@ topics:
|
||||
{% link_in_list /access-permissions-on-github %}
|
||||
{% link_in_list /faq-about-changes-to-githubs-plans %}
|
||||
|
||||
|
||||
{% topic_link_in_list /signing-up-for-github %}
|
||||
{% link_in_list /signing-up-for-a-new-github-account %}
|
||||
{% link_in_list /verifying-your-email-address %}
|
||||
@@ -89,4 +91,25 @@ topics:
|
||||
{% link_in_list /saving-repositories-with-stars %}
|
||||
{% link_in_list /following-people %}
|
||||
|
||||
{% topic_link_in_list /getting-started-with-git %}
|
||||
{% link_in_list /setting-your-username-in-git %}
|
||||
{% link_in_list /caching-your-github-credentials-in-git %}
|
||||
{% link_in_list /why-is-git-always-asking-for-my-password %}
|
||||
{% link_in_list /updating-credentials-from-the-macos-keychain %}
|
||||
{% link_in_list /git-workflows %}
|
||||
{% link_in_list /about-remote-repositories %}
|
||||
{% link_in_list /managing-remote-repositories %}
|
||||
{% link_in_list /associating-text-editors-with-git %}
|
||||
{% link_in_list /configuring-git-to-handle-line-endings %}
|
||||
{% link_in_list /ignoring-files %}
|
||||
|
||||
{% topic_link_in_list /using-git %}
|
||||
{% link_in_list /pushing-commits-to-a-remote-repository %}
|
||||
{% link_in_list /getting-changes-from-a-remote-repository %}
|
||||
{% link_in_list /dealing-with-non-fast-forward-errors %}
|
||||
{% link_in_list /splitting-a-subfolder-out-into-a-new-repository %}
|
||||
{% link_in_list /about-git-subtree-merges %}
|
||||
{% link_in_list /about-git-rebase %}
|
||||
{% link_in_list /using-git-rebase-on-the-command-line %}
|
||||
{% link_in_list /resolving-merge-conflicts-after-a-git-rebase %}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
---
|
||||
title: Managing remote repositories
|
||||
intro: 'Learn to work with your local repositories on your computer and remote repositories hosted on {% data variables.product.product_name %}.'
|
||||
redirect_from:
|
||||
- /categories/18/articles/
|
||||
- /remotes/
|
||||
- /categories/managing-remotes/
|
||||
- /articles/managing-remote-repositories
|
||||
- /articles/adding-a-remote
|
||||
- /github/using-git/adding-a-remote
|
||||
- /articles/changing-a-remote-s-url
|
||||
- /articles/changing-a-remotes-url
|
||||
- /github/using-git/changing-a-remotes-url
|
||||
- /articles/renaming-a-remote
|
||||
- /github/using-git/renaming-a-remote
|
||||
- /articles/removing-a-remote
|
||||
- /github/using-git/removing-a-remote
|
||||
- /github/using-git/managing-remote-repositories
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
### Adding a remote repository
|
||||
|
||||
To add a new remote, use the `git remote add` command on the terminal, in the directory your repository is stored at.
|
||||
|
||||
The `git remote add` command takes two arguments:
|
||||
* A remote name, for example, `origin`
|
||||
* A remote URL, for example, `https://{% data variables.command_line.backticks %}/user/repo.git`
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
$ git remote add origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git
|
||||
# Set a new remote
|
||||
|
||||
$ git remote -v
|
||||
# Verify new remote
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git (push)
|
||||
```
|
||||
|
||||
For more information on which URL to use, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
|
||||
#### Troubleshooting: Remote origin already exists
|
||||
|
||||
This error means you've tried to add a remote with a name that already exists in your local repository.
|
||||
|
||||
```shell
|
||||
$ git remote add origin https://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife.git
|
||||
> fatal: remote origin already exists.
|
||||
```
|
||||
|
||||
To fix this, you can:
|
||||
* Use a different name for the new remote
|
||||
* Rename the existing remote repository
|
||||
* Delete the existing remote repository
|
||||
|
||||
### Changing a remote repository's URL
|
||||
|
||||
The `git remote set-url` command changes an existing remote repository URL.
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** For information on the difference between HTTPS and SSH URLs, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
|
||||
{% endtip %}
|
||||
|
||||
The `git remote set-url` command takes two arguments:
|
||||
|
||||
* An existing remote name. For example, `origin` or `upstream` are two common choices.
|
||||
* A new URL for the remote. For example:
|
||||
* If you're updating to use HTTPS, your URL might look like:
|
||||
```shell
|
||||
https://{% data variables.command_line.backticks %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
* If you're updating to use SSH, your URL might look like:
|
||||
```shell
|
||||
git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
|
||||
#### Switching remote URLs from SSH to HTTPS
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Change the current working directory to your local project.
|
||||
3. List your existing remotes in order to get the name of the remote you want to change.
|
||||
```shell
|
||||
$ git remote -v
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
4. Change your remote's URL from SSH to HTTPS with the `git remote set-url` command.
|
||||
```shell
|
||||
$ git remote set-url origin https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
5. Verify that the remote URL has changed.
|
||||
```shell
|
||||
$ git remote -v
|
||||
# Verify new remote URL
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
The next time you `git fetch`, `git pull`, or `git push` to the remote repository, you'll be asked for your GitHub username and password. {% data reusables.user_settings.password-authentication-deprecation %}
|
||||
|
||||
You can [use a credential helper](/github/getting-started-with-github/caching-your-github-credentials-in-git) so Git will remember your GitHub username and personal access token every time it talks to GitHub.
|
||||
|
||||
#### Switching remote URLs from HTTPS to SSH
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Change the current working directory to your local project.
|
||||
3. List your existing remotes in order to get the name of the remote you want to change.
|
||||
```shell
|
||||
$ git remote -v
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
4. Change your remote's URL from HTTPS to SSH with the `git remote set-url` command.
|
||||
```shell
|
||||
$ git remote set-url origin git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
5. Verify that the remote URL has changed.
|
||||
```shell
|
||||
$ git remote -v
|
||||
# Verify new remote URL
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
#### Troubleshooting: No such remote '[name]'
|
||||
|
||||
This error means that the remote you tried to change doesn't exist:
|
||||
|
||||
```shell
|
||||
$ git remote set-url sofake https://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife
|
||||
> fatal: No such remote 'sofake'
|
||||
```
|
||||
|
||||
Check that you've correctly typed the remote name.
|
||||
|
||||
### Renaming a remote repository
|
||||
|
||||
Use the `git remote rename` command to rename an existing remote.
|
||||
|
||||
The `git remote rename` command takes two arguments:
|
||||
* An existing remote name, for example, `origin`
|
||||
* A new name for the remote, for example, `destination`
|
||||
|
||||
### Example
|
||||
|
||||
These examples assume you're [cloning using HTTPS](/github/getting-started-with-github/about-remote-repositories/#cloning-with-https-urls), which is recommended.
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View existing remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
|
||||
$ git remote rename origin destination
|
||||
# Change remote name from 'origin' to 'destination'
|
||||
|
||||
$ git remote -v
|
||||
# Verify remote's new name
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
#### Troubleshooting: Could not rename config section 'remote.[old name]' to 'remote.[new name]'
|
||||
|
||||
This error means that the remote you tried the old remote name you typed doesn't exist.
|
||||
|
||||
You can check which remotes currently exist with the `git remote -v` command:
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View existing remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
#### Troubleshooting: Remote [new name] already exists
|
||||
|
||||
This error means that the remote name you want to use already exists. To solve this, either use a different remote name, or rename the original remote.
|
||||
|
||||
### Removing a remote repository
|
||||
|
||||
Use the `git remote rm` command to remove a remote URL from your repository.
|
||||
|
||||
The `git remote rm` command takes one argument:
|
||||
* A remote name, for example, `destination`
|
||||
|
||||
### Example
|
||||
|
||||
These examples assume you're [cloning using HTTPS](/github/getting-started-with-github/about-remote-repositories/#cloning-with-https-urls), which is recommended.
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View current remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (fetch)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (push)
|
||||
|
||||
$ git remote rm destination
|
||||
# Remove remote
|
||||
$ git remote -v
|
||||
# Verify it's gone
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Note**: `git remote rm` does not delete the remote repository from the server. It simply
|
||||
removes the remote and its references from your local repository.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
#### Troubleshooting: Could not remove config section 'remote.[name]'
|
||||
|
||||
This error means that the remote you tried to delete doesn't exist:
|
||||
|
||||
```shell
|
||||
$ git remote rm sofake
|
||||
> error: Could not remove config section 'remote.sofake'
|
||||
```
|
||||
|
||||
Check that you've correctly typed the remote name.
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)
|
||||
@@ -4,6 +4,7 @@ intro: Use `git push` to push commits made on your local branch to a remote repo
|
||||
redirect_from:
|
||||
- /articles/pushing-to-a-remote/
|
||||
- /articles/pushing-commits-to-a-remote-repository
|
||||
- /github/using-git/pushing-commits-to-a-remote-repository
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -42,7 +43,7 @@ repository you're pushing to, you'll get a message saying `non-fast-forward upda
|
||||
This means that you must retrieve, or "fetch," the upstream changes, before
|
||||
you are able to push your local changes.
|
||||
|
||||
For more information on this error, see "[Dealing with non-fast-forward errors](/articles/dealing-with-non-fast-forward-errors)."
|
||||
For more information on this error, see "[Dealing with non-fast-forward errors](/github/getting-started-with-github/dealing-with-non-fast-forward-errors)."
|
||||
|
||||
### Pushing tags
|
||||
|
||||
@@ -110,5 +111,5 @@ For more information on working with forks, see "[Syncing a fork](/articles/sync
|
||||
- [The "Remotes" chapter from the "Pro Git" book](https://git-scm.com/book/ch5-2.html)
|
||||
- [`git remote` man page](https://git-scm.com/docs/git-remote.html)
|
||||
- "[Git cheatsheet](/articles/git-cheatsheet)"
|
||||
- "[Git workflows](/articles/git-workflows)"
|
||||
- "[Git workflows](/github/getting-started-with-github/git-workflows)"
|
||||
- "[Git Handbook](https://guides.github.com/introduction/git-handbook/)"
|
||||
@@ -3,6 +3,7 @@ title: Resolving merge conflicts after a Git rebase
|
||||
intro: 'When you perform a `git rebase` operation, you''re typically moving commits around. Because of this, you might get into a situation where a merge conflict is introduced. That means that two of your commits modified the same line in the same file, and Git doesn''t know which change to apply.'
|
||||
redirect_from:
|
||||
- /articles/resolving-merge-conflicts-after-a-git-rebase
|
||||
- /github/using-git/resolving-merge-conflicts-after-a-git-rebase
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -36,7 +36,7 @@ If you don't need to work with files locally, {% data variables.product.product_
|
||||
### Setting up Git
|
||||
|
||||
1. [Download and install the latest version of Git](https://git-scm.com/downloads).
|
||||
2. [Set your username in Git](/articles/setting-your-username-in-git).
|
||||
2. [Set your username in Git](/github/getting-started-with-github/setting-your-username-in-git).
|
||||
3. [Set your commit email address in Git](/articles/setting-your-commit-email-address).
|
||||
|
||||
### Next steps: Authenticating with {% data variables.product.prodname_dotcom %} from Git
|
||||
@@ -45,11 +45,11 @@ When you connect to a {% data variables.product.product_name %} repository from
|
||||
|
||||
#### Connecting over HTTPS (recommended)
|
||||
|
||||
If you [clone with HTTPS](/articles/which-remote-url-should-i-use/#cloning-with-https-urls), you can [cache your {% data variables.product.prodname_dotcom %} credentials in Git](/github/using-git/caching-your-github-credentials-in-git) using a credential helper.
|
||||
If you [clone with HTTPS](/github/getting-started-with-github/about-remote-repositories/#cloning-with-https-urls), you can [cache your {% data variables.product.prodname_dotcom %} credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git) using a credential helper.
|
||||
|
||||
#### Connecting over SSH
|
||||
|
||||
If you [clone with SSH](/articles/which-remote-url-should-i-use#cloning-with-ssh-urls), you must [generate SSH keys](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) on each computer you use to push or pull from {% data variables.product.product_name %}.
|
||||
If you [clone with SSH](/github/getting-started-with-github/about-remote-repositories/#cloning-with-ssh-urls), you must [generate SSH keys](/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) on each computer you use to push or pull from {% data variables.product.product_name %}.
|
||||
|
||||
### Celebrate
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ title: Setting your username in Git
|
||||
intro: 'Git uses a username to associate commits with an identity. The Git username is not the same as your {% data variables.product.product_name %} username.'
|
||||
redirect_from:
|
||||
- /articles/setting-your-username-in-git
|
||||
- /github/using-git/setting-your-username-in-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -3,6 +3,7 @@ title: Splitting a subfolder out into a new repository
|
||||
redirect_from:
|
||||
- /articles/splitting-a-subpath-out-into-a-new-repository/
|
||||
- /articles/splitting-a-subfolder-out-into-a-new-repository
|
||||
- /github/using-git/splitting-a-subfolder-out-into-a-new-repository
|
||||
intro: You can turn a folder within a Git repository into a brand new repository.
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -49,7 +50,7 @@ If you create a new clone of the repository, you won't lose any of your Git hist
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** For information on the difference between HTTPS and SSH URLs, see "[Which remote URL should I use?](/articles/which-remote-url-should-i-use)"
|
||||
**Tip:** For information on the difference between HTTPS and SSH URLs, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
|
||||
{% endtip %}
|
||||
|
||||
@@ -4,6 +4,7 @@ intro: 'You''ll need to update your saved credentials in the `git-credential-osx
|
||||
redirect_from:
|
||||
- /articles/updating-credentials-from-the-osx-keychain
|
||||
- /github/using-git/updating-credentials-from-the-osx-keychain
|
||||
- /github/using-git/updating-credentials-from-the-macos-keychain
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -35,4 +36,4 @@ If it's successful, nothing will print out. To test that it works, try and clone
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Caching your {% data variables.product.prodname_dotcom %} credentials in Git](/github/using-git/caching-your-github-credentials-in-git/)"
|
||||
- "[Caching your {% data variables.product.prodname_dotcom %} credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git/)"
|
||||
@@ -3,6 +3,7 @@ title: Using Git rebase on the command line
|
||||
redirect_from:
|
||||
- /articles/using-git-rebase/
|
||||
- /articles/using-git-rebase-on-the-command-line
|
||||
- /github/using-git/using-git-rebase-on-the-command-line
|
||||
intro: Here's a short tutorial on using `git rebase` on the command line.
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -139,4 +140,4 @@ Force pushing has serious implications because it changes the historical sequenc
|
||||
|
||||
### Further reading
|
||||
|
||||
* "[Resolving merge conflicts after a Git rebase](/articles/resolving-merge-conflicts-after-a-git-rebase)"
|
||||
* "[Resolving merge conflicts after a Git rebase](/github/getting-started-with-github/resolving-merge-conflicts-after-a-git-rebase)"
|
||||
@@ -1,8 +1,11 @@
|
||||
---
|
||||
title: Using advanced Git commands
|
||||
title: Using Git
|
||||
intro: ''
|
||||
mapTopic: true
|
||||
redirect_from:
|
||||
- /articles/using-common-git-commands
|
||||
- /github/using-git/using-common-git-commands
|
||||
- /github/using-git/using-advanced-git-commands
|
||||
- /categories/52/articles/
|
||||
- /categories/advanced-git/
|
||||
- /articles/using-advanced-git-commands
|
||||
@@ -12,4 +15,3 @@ versions:
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
@@ -3,6 +3,7 @@ title: Why is Git always asking for my password?
|
||||
intro: 'If Git prompts you for a username and password every time you try to interact with GitHub, you''re probably using the HTTPS clone URL for your repository.'
|
||||
redirect_from:
|
||||
- /articles/why-is-git-always-asking-for-my-password
|
||||
- /github/using-git/why-is-git-always-asking-for-my-password
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
@@ -13,10 +14,10 @@ Using an HTTPS remote URL has some advantages compared with using SSH. It's easi
|
||||
|
||||
{% data reusables.user_settings.password-authentication-deprecation %}
|
||||
|
||||
You can avoid being prompted for your password by configuring Git to [cache your credentials](/github/using-git/caching-your-github-credentials-in-git) for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.
|
||||
You can avoid being prompted for your password by configuring Git to [cache your credentials](/github/getting-started-with-github/caching-your-github-credentials-in-git) for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.
|
||||
|
||||
### Further reading
|
||||
|
||||
* "[Which remote URL should I use](/articles/which-remote-url-should-i-use/#cloning-with-https-urls)"
|
||||
* "[About authentication to {% data variables.product.prodname_dotcom %}](/github/authenticating-to-github/about-authentication-to-github)"
|
||||
* "[Adding your SSH key to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent)"
|
||||
- "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)."
|
||||
- "[About authentication to {% data variables.product.prodname_dotcom %}](/github/authenticating-to-github/about-authentication-to-github)"
|
||||
- "[Adding your SSH key to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent)"
|
||||
@@ -41,14 +41,14 @@ versions:
|
||||
```
|
||||
7. At the top of your {% data variables.product.product_name %} repository's Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
|
||||

|
||||
8. In Terminal, [add the URL for the remote repository](/articles/adding-a-remote) where your local repository will be pushed.
|
||||
8. In Terminal, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
|
||||
```shell
|
||||
$ git remote add origin <em> <REMOTE_URL> </em>
|
||||
# Sets the new remote
|
||||
$ git remote -v
|
||||
# Verifies the new remote URL
|
||||
```
|
||||
9. [Push the changes](/articles/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
```shell
|
||||
$ git push -u origin main
|
||||
# Pushes the changes in your local repository up to the remote repository you specified as the origin
|
||||
@@ -78,14 +78,14 @@ versions:
|
||||
```
|
||||
7. At the top of your {% data variables.product.product_name %} repository's Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
|
||||

|
||||
8. In the Command prompt, [add the URL for the remote repository](/articles/adding-a-remote) where your local repository will be pushed.
|
||||
8. In the Command prompt, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
|
||||
```shell
|
||||
$ git remote add origin <em> <REMOTE_URL> </em>
|
||||
# Sets the new remote
|
||||
$ git remote -v
|
||||
# Verifies the new remote URL
|
||||
```
|
||||
9. [Push the changes](/articles/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
```shell
|
||||
$ git push origin main
|
||||
# Pushes the changes in your local repository up to the remote repository you specified as the origin
|
||||
@@ -115,14 +115,14 @@ versions:
|
||||
```
|
||||
7. At the top of your {% data variables.product.product_name %} repository's Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
|
||||

|
||||
8. In Terminal, [add the URL for the remote repository](/articles/adding-a-remote) where your local repository will be pushed.
|
||||
8. In Terminal, [add the URL for the remote repository](/github/getting-started-with-github/managing-remote-repositories) where your local repository will be pushed.
|
||||
```shell
|
||||
$ git remote add origin <em> <REMOTE_URL> </em>
|
||||
# Sets the new remote
|
||||
$ git remote -v
|
||||
# Verifies the new remote URL
|
||||
```
|
||||
9. [Push the changes](/articles/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
9. [Push the changes](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/) in your local repository to {% data variables.product.product_location %}.
|
||||
```shell
|
||||
$ git push origin main
|
||||
# Pushes the changes in your local repository up to the remote repository you specified as the origin
|
||||
|
||||
@@ -41,7 +41,7 @@ We recommend these tools for moving changes between Team Foundation Server and G
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** After you've successfully converted your project to Git, you can [push it to {% data variables.product.prodname_dotcom %}](/articles/pushing-commits-to-a-remote-repository/).
|
||||
**Tip:** After you've successfully converted your project to Git, you can [push it to {% data variables.product.prodname_dotcom %}](/github/getting-started-with-github/pushing-commits-to-a-remote-repository/).
|
||||
|
||||
{% endtip %}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ For more information, see “[Git Tools Submodules](https://git-scm.com/book/en/
|
||||
|
||||
### Preserving history
|
||||
|
||||
SVN is configured to assume that the history of a project never changes. Git allows you to modify previous commits and changes using tools like [`git rebase`](/articles/about-git-rebase).
|
||||
SVN is configured to assume that the history of a project never changes. Git allows you to modify previous commits and changes using tools like [`git rebase`](/github/getting-started-with-github/about-git-rebase).
|
||||
|
||||
{% tip %}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ versions:
|
||||
|
||||
{% link_in_list /creating-cloning-and-archiving-repositories %}
|
||||
|
||||
{% link_in_list /using-git %}
|
||||
|
||||
{% link_in_list /committing-changes-to-your-project %}
|
||||
|
||||
{% link_in_list /collaborating-with-issues-and-pull-requests %}
|
||||
|
||||
@@ -26,7 +26,7 @@ After changing your organization's name, your old organization name becomes avai
|
||||
#### Changes that occur automatically
|
||||
|
||||
- {% data variables.product.prodname_dotcom %} automatically redirects references to your repositories. Web links to your organization's existing **repositories** will continue to work. This can take a few minutes to complete after you initiate the change.
|
||||
- You can continue pushing your local repositories to the old remote tracking URL without updating it. However, we recommend you update all existing remote repository URLs after changing your organization name. Because your old organization name is available for use by anyone else after you change it, the new organization owner can create repositories that override the redirect entries to your repository. For more information, see "[Changing a remote's URL](/articles/changing-a-remote-s-url)."
|
||||
- You can continue pushing your local repositories to the old remote tracking URL without updating it. However, we recommend you update all existing remote repository URLs after changing your organization name. Because your old organization name is available for use by anyone else after you change it, the new organization owner can create repositories that override the redirect entries to your repository. For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
- Previous Git commits will also be correctly attributed to users within your organization.
|
||||
|
||||
#### Changes that aren't automatic
|
||||
@@ -46,5 +46,4 @@ After changing your organization's name:
|
||||
|
||||
### Further reading
|
||||
|
||||
* "[Changing a remote's URL](/articles/changing-a-remote-s-url)"
|
||||
* "[Why are my commits linked to the wrong user?](/articles/why-are-my-commits-linked-to-the-wrong-user)"
|
||||
|
||||
@@ -32,7 +32,7 @@ After you change your username, {% data variables.product.product_name %} will a
|
||||
- Web links to your existing repositories will continue to work. This can take a few minutes to complete after you make the change.
|
||||
- Command line pushes from your local repository clones to the old remote tracking URLs will continue to work.
|
||||
|
||||
If the new owner of your old username creates a repository with the same name as your repository, that will override the redirect entry and your redirect will stop working. Because of this possibility, we recommend you update all existing remote repository URLs after changing your username. For more information, see "[Changing a remote's URL](/articles/changing-a-remote-s-url)."
|
||||
If the new owner of your old username creates a repository with the same name as your repository, that will override the redirect entry and your redirect will stop working. Because of this possibility, we recommend you update all existing remote repository URLs after changing your username. For more information, see "[Managing remote repositories](/github/getting-started-with-github/managing-remote-repositories)."
|
||||
|
||||
### Links to your previous profile page
|
||||
|
||||
@@ -58,6 +58,5 @@ After changing your username, links to your previous profile page, such as `http
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Changing a remote's URL](/articles/changing-a-remote-s-url)"
|
||||
- "[Why are my commits linked to the wrong user?](/articles/why-are-my-commits-linked-to-the-wrong-user)"{% if currentVersion == "free-pro-team@latest" %}
|
||||
- "[{% data variables.product.prodname_dotcom %} Username Policy](/articles/github-username-policy)"{% endif %}
|
||||
|
||||
@@ -18,7 +18,7 @@ topics:
|
||||
{% endtip %}
|
||||
|
||||
1. [Transfer any repositories](/articles/how-to-transfer-a-repository) from the account you want to delete to the account you want to keep. Issues, pull requests, and wikis are transferred as well. Verify the repositories exist on the account you want to keep.
|
||||
2. [Update the remote URLs](/articles/changing-a-remote-s-url) in any local clones of the repositories that were moved.
|
||||
2. [Update the remote URLs](/github/getting-started-with-github/managing-remote-repositories) in any local clones of the repositories that were moved.
|
||||
3. [Delete the account](/articles/deleting-your-user-account) you no longer want to use.
|
||||
|
||||
### Further reading
|
||||
|
||||
@@ -36,7 +36,7 @@ topics:
|
||||
|
||||
### Finding your username in your `user.name` configuration
|
||||
|
||||
During set up, you may have [set your username in Git](/articles/setting-your-username-in-git). If so, you can review the value of this configuration setting:
|
||||
During set up, you may have [set your username in Git](/github/getting-started-with-github/setting-your-username-in-git). If so, you can review the value of this configuration setting:
|
||||
|
||||
```shell
|
||||
$ git config user.name
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
title: About remote repositories
|
||||
redirect_from:
|
||||
- /articles/working-when-github-goes-down/
|
||||
- /articles/sharing-repositories-without-github/
|
||||
- /articles/about-remote-repositories
|
||||
intro: 'GitHub''s collaborative approach to development depends on publishing commits from your local repository for other people to view, fetch, and update.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
A remote URL is Git's fancy way of saying "the place where your code is stored."
|
||||
That URL could be your repository on GitHub, or another user's fork, or even on
|
||||
a completely different server.
|
||||
|
||||
You can only push to two types of URL addresses:
|
||||
|
||||
* An HTTPS URL like `https://{% data variables.command_line.backticks %}/user/repo.git`
|
||||
* An SSH URL, like `git@{% data variables.command_line.backticks %}:user/repo.git`
|
||||
|
||||
Git associates a remote URL with a name, and your default remote is usually called `origin`.
|
||||
|
||||
For information on the differences between these URLs, see "[Which remote URL should I use?](/articles/which-remote-url-should-i-use)"
|
||||
|
||||
### Creating remotes
|
||||
|
||||
You can use the `git remote add` command to match a remote URL with a name.
|
||||
For example, you'd type the following in the command line:
|
||||
|
||||
```shell
|
||||
git remote add origin <em> <REMOTE_URL> </em>
|
||||
```
|
||||
|
||||
This associates the name `origin` with the `REMOTE_URL`.
|
||||
|
||||
You can use the command `git remote set-url` to [change a remote's URL](/articles/changing-a-remote-s-url).
|
||||
@@ -1,52 +0,0 @@
|
||||
---
|
||||
title: Adding a remote
|
||||
intro: 'To add a new remote, use the `git remote add` command on the terminal, in the directory your repository is stored at.'
|
||||
redirect_from:
|
||||
- /articles/adding-a-remote
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
The `git remote add` command takes two arguments:
|
||||
|
||||
* A remote name, for example, `origin`
|
||||
* A remote URL, for example, `https://{% data variables.command_line.backticks %}/user/repo.git`
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
$ git remote add origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git
|
||||
# Set a new remote
|
||||
|
||||
$ git remote -v
|
||||
# Verify new remote
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git (push)
|
||||
```
|
||||
|
||||
Not sure which URL to use? Check out "[Which remote URL should I use?](/articles/which-remote-url-should-i-use)"
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
You may encounter these errors when trying to add a remote.
|
||||
|
||||
#### Remote `name` already exists
|
||||
|
||||
This error means you've tried to add a remote with a name that already exists in your local repository:
|
||||
|
||||
```shell
|
||||
$ git remote add origin https://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife.git
|
||||
> fatal: remote origin already exists.
|
||||
```
|
||||
|
||||
To fix this, you can
|
||||
|
||||
* Use a different name for the new remote
|
||||
* [Rename the existing remote](/articles/renaming-a-remote)
|
||||
* [Delete the existing remote](/articles/removing-a-remote)
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)
|
||||
@@ -1,97 +0,0 @@
|
||||
---
|
||||
title: Changing a remote's URL
|
||||
redirect_from:
|
||||
- /articles/changing-a-remote-s-url
|
||||
- /articles/changing-a-remotes-url
|
||||
intro: The `git remote set-url` command changes an existing remote repository URL.
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** For information on the difference between HTTPS and SSH URLs, see "[Which remote URL should I use?](/articles/which-remote-url-should-i-use)"
|
||||
|
||||
{% endtip %}
|
||||
|
||||
The `git remote set-url` command takes two arguments:
|
||||
|
||||
* An existing remote name. For example, `origin` or `upstream` are two common choices.
|
||||
* A new URL for the remote. For example:
|
||||
* If you're updating to use HTTPS, your URL might look like:
|
||||
```shell
|
||||
https://{% data variables.command_line.backticks %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
* If you're updating to use SSH, your URL might look like:
|
||||
```shell
|
||||
git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
|
||||
### Switching remote URLs from SSH to HTTPS
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Change the current working directory to your local project.
|
||||
3. List your existing remotes in order to get the name of the remote you want to change.
|
||||
```shell
|
||||
$ git remote -v
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
4. Change your remote's URL from SSH to HTTPS with the `git remote set-url` command.
|
||||
```shell
|
||||
$ git remote set-url origin https://{% data variables.command_line.codeblock %}/<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
5. Verify that the remote URL has changed.
|
||||
```shell
|
||||
$ git remote -v
|
||||
# Verify new remote URL
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
The next time you `git fetch`, `git pull`, or `git push` to the remote repository, you'll be asked for your GitHub username and password. {% data reusables.user_settings.password-authentication-deprecation %}
|
||||
|
||||
You can [use a credential helper](/github/using-git/caching-your-github-credentials-in-git) so Git will remember your GitHub username and personal access token every time it talks to GitHub.
|
||||
|
||||
### Switching remote URLs from HTTPS to SSH
|
||||
|
||||
{% data reusables.command_line.open_the_multi_os_terminal %}
|
||||
2. Change the current working directory to your local project.
|
||||
3. List your existing remotes in order to get the name of the remote you want to change.
|
||||
```shell
|
||||
$ git remote -v
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
4. Change your remote's URL from HTTPS to SSH with the `git remote set-url` command.
|
||||
```shell
|
||||
$ git remote set-url origin git@{% data variables.command_line.codeblock %}:<em>USERNAME</em>/<em>REPOSITORY</em>.git
|
||||
```
|
||||
5. Verify that the remote URL has changed.
|
||||
```shell
|
||||
$ git remote -v
|
||||
# Verify new remote URL
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (fetch)
|
||||
> origin git@{% data variables.command_line.codeblock %}:<em>USERNAME/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
You may encounter these errors when trying to change a remote.
|
||||
|
||||
#### No such remote '[name]'
|
||||
|
||||
This error means that the remote you tried to change doesn't exist:
|
||||
|
||||
```shell
|
||||
$ git remote set-url sofake https://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife
|
||||
> fatal: No such remote 'sofake'
|
||||
```
|
||||
|
||||
Check that you've correctly typed the remote name.
|
||||
|
||||
### Further reading
|
||||
|
||||
- ["Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)
|
||||
@@ -1,42 +0,0 @@
|
||||
---
|
||||
title: Using Git
|
||||
intro: 'Learn common and advanced workflows in Git to enhance your experience using {% data variables.product.prodname_dotcom %}.'
|
||||
redirect_from:
|
||||
- /categories/19/articles/
|
||||
- /categories/using-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
|
||||
### Table of Contents
|
||||
|
||||
{% topic_link_in_list /getting-started-with-git-and-github %}
|
||||
{% link_in_list /setting-your-username-in-git %}
|
||||
{% link_in_list /caching-your-github-credentials-in-git %}
|
||||
{% link_in_list /why-is-git-always-asking-for-my-password %}
|
||||
{% link_in_list /updating-credentials-from-the-macos-keychain %}
|
||||
{% topic_link_in_list /learning-about-git %}
|
||||
{% link_in_list /git-workflows %}
|
||||
{% link_in_list /associating-text-editors-with-git %}
|
||||
{% link_in_list /configuring-git-to-handle-line-endings %}
|
||||
{% link_in_list /ignoring-files %}
|
||||
{% topic_link_in_list /using-common-git-commands %}
|
||||
{% link_in_list /pushing-commits-to-a-remote-repository %}
|
||||
{% link_in_list /getting-changes-from-a-remote-repository %}
|
||||
{% link_in_list /dealing-with-non-fast-forward-errors %}
|
||||
{% topic_link_in_list /managing-remote-repositories %}
|
||||
{% link_in_list /about-remote-repositories %}
|
||||
{% link_in_list /which-remote-url-should-i-use %}
|
||||
{% link_in_list /adding-a-remote %}
|
||||
{% link_in_list /changing-a-remotes-url %}
|
||||
{% link_in_list /renaming-a-remote %}
|
||||
{% link_in_list /removing-a-remote %}
|
||||
{% topic_link_in_list /using-advanced-git-commands %}
|
||||
{% link_in_list /about-git-rebase %}
|
||||
{% link_in_list /using-git-rebase-on-the-command-line %}
|
||||
{% link_in_list /resolving-merge-conflicts-after-a-git-rebase %}
|
||||
{% link_in_list /about-git-subtree-merges %}
|
||||
{% link_in_list /splitting-a-subfolder-out-into-a-new-repository %}
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
title: Learning about Git
|
||||
intro: ''
|
||||
mapTopic: true
|
||||
redirect_from:
|
||||
- /articles/learning-about-git
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: Managing remote repositories
|
||||
intro: 'Learn to work with your local repositories on your computer and remote repositories hosted on {% data variables.product.product_name %}.'
|
||||
mapTopic: true
|
||||
redirect_from:
|
||||
- /categories/18/articles/
|
||||
- /remotes/
|
||||
- /categories/managing-remotes/
|
||||
- /articles/managing-remote-repositories
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
---
|
||||
title: Removing a remote
|
||||
intro: Use the `git remote rm` command to remove a remote URL from your repository.
|
||||
redirect_from:
|
||||
- /articles/removing-a-remote
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
The `git remote rm` command takes one argument:
|
||||
|
||||
* A remote name, for example, `destination`
|
||||
|
||||
### Example
|
||||
|
||||
These examples assume you're [cloning using HTTPS](/articles/which-remote-url-should-i-use/#cloning-with-https-urls), which is recommended.
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View current remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (fetch)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>FORKER/REPOSITORY</em>.git (push)
|
||||
|
||||
$ git remote rm destination
|
||||
# Remove remote
|
||||
$ git remote -v
|
||||
# Verify it's gone
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER/REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Note**: `git remote rm` does not delete the remote repository from the server. It simply
|
||||
removes the remote and its references from your local repository.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
You may encounter these errors when trying to remove a remote.
|
||||
|
||||
#### Could not remove config section 'remote.[name]'
|
||||
|
||||
This error means that the remote you tried to delete doesn't exist:
|
||||
|
||||
```shell
|
||||
$ git remote rm sofake
|
||||
> error: Could not remove config section 'remote.sofake'
|
||||
```
|
||||
|
||||
Check that you've correctly typed the remote name.
|
||||
|
||||
### Further reading
|
||||
|
||||
- ["Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)
|
||||
@@ -1,60 +0,0 @@
|
||||
---
|
||||
title: Renaming a remote
|
||||
intro: Use the `git remote rename` command to rename an existing remote.
|
||||
redirect_from:
|
||||
- /articles/renaming-a-remote
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
The `git remote rename` command takes two arguments:
|
||||
|
||||
* An existing remote name, for example, `origin`
|
||||
* A new name for the remote, for example, `destination`
|
||||
|
||||
### Example
|
||||
|
||||
These examples assume you're [cloning using HTTPS](/articles/which-remote-url-should-i-use/#cloning-with-https-urls), which is recommended.
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View existing remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
|
||||
$ git remote rename origin destination
|
||||
# Change remote name from 'origin' to 'destination'
|
||||
|
||||
$ git remote -v
|
||||
# Verify remote's new name
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> destination https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
You may encounter these errors when trying to rename a remote.
|
||||
|
||||
#### Could not rename config section 'remote.[old name]' to 'remote.[new name]'
|
||||
|
||||
This error means that the remote you tried the old remote name you typed doesn't exist.
|
||||
|
||||
You can check which remotes currently exist with the `git remote -v` command:
|
||||
|
||||
```shell
|
||||
$ git remote -v
|
||||
# View existing remotes
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (fetch)
|
||||
> origin https://{% data variables.command_line.codeblock %}/<em>OWNER</em>/<em>REPOSITORY</em>.git (push)
|
||||
```
|
||||
|
||||
#### Remote [new name] already exists.
|
||||
|
||||
This error means that the remote name you want to use already exists. To solve this,
|
||||
either use a different remote name, or rename the original remote.
|
||||
|
||||
### Further reading
|
||||
|
||||
- ["Working with Remotes" from the _Pro Git_ book](https://git-scm.com/book/en/Git-Basics-Working-with-Remotes)
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
title: Using common Git commands
|
||||
intro: ''
|
||||
mapTopic: true
|
||||
redirect_from:
|
||||
- /articles/using-common-git-commands
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '*'
|
||||
github-ae: '*'
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user