Change into your code directory: cd ~/code.In your terminal, create a new directory and add a file.(We'll use this in the next section.)Ĭonnecting your remote repo to a local repo Click the "Copy to clipboard" symbol next to the repo URL (pictured) to copy the URL. After you create the repo, you should see a "Quick setup" page.Click the green Create repository button. You can name it whatever you'd like be creative! The default options are fine as-is - don't initialize the new repository with a README or add a. Enter a name for your repository in the Repository name field.While logged into GitHub, click the in the menubar and select New repository.However, this is rarely the case, and we want to work with others! So, we have to talk about remotes. If you don't want to work with anyone else, you don't need remotes. It's just another git repository in the cloud. GitHub does nothing special in the git universe. Use git push to connect your local repository of files to your remote repository.Describe GitHub and its relationship with Git.> destination FORKER/REPOSITORY.git (fetch) It does not delete the remote repository. Removing the remote URL from your repository only unlinks the local and remote repositories. A remote name, for example, destination.The git remote rm command takes one argument: Use the git remote rm command to remove a remote URL from your repository. To solve this, either use a different remote name, or rename the original remote. This error means that the remote name you want to use already exists. > origin OWNER/ REPOSITORY.git (push) Troubleshooting: Remote already exists You can check which remotes currently exist with the git remote -v command: $ git remote -v This error means that the old remote name you typed doesn't exist. > destination OWNER/ REPOSITORY.git (push) Troubleshooting: Could not rename config section 'remote.' to 'remote.' > destination OWNER/ REPOSITORY.git (fetch) # Change remote name from 'origin' to 'destination' These examples assume you're cloning using HTTPS, which is recommended. A new name for the remote, for example, destination.An existing remote name, for example, origin.The git remote rename command takes two arguments: Use the git remote rename command to rename an existing remote. This error means that the remote you tried to change doesn't exist: $ git remote set-url sofake Ĭheck that you've correctly typed the remote name. Change your remote's URL from HTTPS to SSH with the git remote set-url command.You can use a credential helper so Git will remember your GitHub username and personal access token every time it talks to GitHub. For more information, see " Creating a personal access token." Password-based authentication for Git has been removed in favor of more secure authentication methods.
Alternatively, you can use a credential helper like Git Credential Manager. When Git prompts you for your password, enter your personal access token (PAT). 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. Verify that the remote URL has changed.$ git remote set-url origin USERNAME/ REPOSITORY.git Change your remote's URL from SSH to HTTPS with the git remote set-url command.List your existing remotes in order to get the name of the remote you want to change.Change the current working directory to your local project.If you're updating to use SSH, your URL might look USERNAME/ REPOSITORY.git.If you're updating to use HTTPS, your URL might look like:.For example, origin or upstream are two common choices. The git remote set-url command takes two arguments: Tip: For information on the difference between HTTPS and SSH URLs, see " About remote repositories." The git remote set-url command changes an existing remote repository URL. For more information, see " Removing a remote repository" below. Delete the existing remote repository before you add the new remote.For more information, see " Renaming a remote repository" below. Rename the existing remote repository before you add the new remote.Use a different name for the new remote.This error means you've tried to add a remote with a name that already exists in your local repository.
The git remote add command takes two arguments:įor example: $ git remote add origin user/ repo.gitįor more information on which URL to use, see " About remote repositories." Troubleshooting: Remote origin already exists To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at.