
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.įor information on setting or changing your remote URL, see " Managing remote repositories." Cloning with HTTPS URLs There are several ways to clone repositories available on. Choosing a URL for your remote repository You can use the command git remote set-url to change a remote's URL. This associates the name origin with the REMOTE_URL. You can use the git remote add command to match a remote URL with a name.įor example, you'd type the following in the command line: git remote add origin
Github cli ssh code#
Paste the text below, substituting in the email address for your account on GitHub.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. Insert your hardware security key into your computer. For more information, see " Error: Unknown key type."
Github cli ssh install#
If you are using macOS or Linux, you may need to update your SSH client or install a new SSH client prior to generating a new SSH key. Generating a new SSH key for a hardware security key For more information, see " Adding a new SSH key to your GitHub account." ssh-add ~/.ssh/id_ed25519Īdd the SSH public key to your account on GitHub. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file. Host Īdd your SSH private key to the ssh-agent. If your SSH key file has a different name or path than the example code, modify the filename or path to match your current setup. Open your ~/.ssh/config file, then modify the file to contain the following lines. If the file doesn't exist, create the file. $ open ~/.ssh/config > The file /Users/YOU/.ssh/config does not exist. If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.įirst, check to see if your ~/.ssh/config file exists in the default location. For example, you may need to use root access by running sudo -s -H before starting the ssh-agent, or you may need to use exec ssh-agent bash or exec ssh-agent zsh to run the ssh-agent. $ eval " $(ssh-agent -s)" > Agent pid 59566ĭepending on your environment, you may need to use a different command. After you generate the key, you can add the public key to your account on to enable authentication for Git operations over SSH. You can generate a new SSH key on your local machine. For more information, see the OpenSSH 8.2 release notes. You must connect your hardware security key to your computer when you authenticate with the key pair. If you want to use a hardware security key to authenticate to GitHub, you must generate a new SSH key for your hardware security key.

For more information, see " Checking for existing SSH keys." If you're unsure whether you already have an SSH key, you can check for existing keys.

If you don't already have an SSH key, you must generate a new SSH key to use for authentication. The SSH agent manages your SSH keys and remembers your passphrase. If your key has a passphrase and you don't want to enter the passphrase every time you use the key, you can add your key to the SSH agent. Whenever you use the key, you must enter the passphrase. When you generate an SSH key, you can add a passphrase to further secure the key. When you connect via SSH, you authenticate using a private key file on your local machine. You can access and write data in repositories on using SSH (Secure Shell Protocol).
