как создать ssh key github windows 10

Работа c GitHub по SSH под Windows 10

Git умеет работать с четырьмя сетевыми протоколами для передачи данных: локальный, Secure Shell (SSH), Git и HTTP. Положительным аспектом использования протокола HTTP(S) является простота настройки. Поэтому при работе с GitHub он используется чаще всего.

Как настроить работу с репозиторием на GitHub.com по SSH под Windows 10? Для начала посмотрим, какие ssh-ключи уже есть в системе:

Ключей еще нет, директория пуста. Сгенерируем ключи командой

Сначала необходимо указать расположение файла для сохранения ключа. Просто жмем Enter, чтобы сохранить ключ в файле по умолчанию (

/.ssh/id_rsa ). Затем надо дважды ввести пароль (который можно оставить пустым, чтобы не вводить каждый раз).

Теперь добавим сгенерированный ключ в свой SSH-агент. Включаем SSH-агент командой

Добавляем в него ключ

Теперь надо добавить наш ключ в аккаунте GitHub. Авторизуемся и переходим на страницу https://github.com/settings/keys, жмем кнопку «New SSH key» и вставляем содержимое файла

/.ssh/id_rsa в текстовое поле «Key».

как создать ssh key github windows 10

Теперь можно использовать SSH вместо HTTPS. Смотрим, какой должна быть ссылка проекта на GitHub, предварительно выбрав «Use SSH» (вместо «Use HTTPS»):

как создать ssh key github windows 10

И выполняем команду:

Чтобы не вводить каждый раз пароль при работе с репозиторием на GitHub, нужно создать файл C:/Users/UserName/.bashrc и добавить туда следующее:

Теперь запрос пароля будет происходить только один раз, при запуске (каждой новой) консоли.

Источник

Настроим пошагово Git SSH для Windows 10. Это позволит вам выполнять команды git без ввода пароля от своей учетной записи GitHub.

как создать ssh key github windows 10

Генерация ключа SSH

Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Добавление SSH-ключа в ssh-agent

Чтобы запустить ssh-агент введите следующую команду.

На экране отобразится похожая строка.

Добавление ключа SSH в учетную запись GitHub

Сейчас нам необходимо скопировать SSH ключ в буфер обмена.

Способов есть несколько, но я же вам предлагаю следующее решения для Windows 10: введите команду ниже.

Прямо в терминале вы увидите содержимое необходимого файла с ключем. Скопируйте его в буфер.

как создать ssh key github windows 10

Перейдите во вкладку SSH and GPG keys и нажмите на кнопку New SSH key для добавления SSH ключа в вашу учетную запись GitHub.

как создать ssh key github windows 10

В поле Title добавьте заголок для данного ключа. Например, если вы захотите настроить SSH доступ на нескольких устройствах, то вы будите понимать какой ключ принадлежит какому устройству.

В поле Key добавьте свой ssh-ключ, который вы скопировали в буфер обмена на предыдущем шаге.

как создать ssh key github windows 10

На этом настройка SSH для вашего устройства завершена, теперь вы можете работать с git без ввода пароля от своей учетной записи.

Если вам понравилась данная статья, можете прочитать как настроить моментальную загрузку сайта на хостинг и синхронизацию файлов.

Надеюсь, вам понравилась данная информация. Если вам интересна тема web-разработки, то можете следить за выходом новых статей в Telegram.

Источник

Generating a new SSH key and adding it to the ssh-agent

In this article

After you’ve checked for existing SSH keys, you can generate a new SSH key to use for authentication, then add it to the ssh-agent.

About SSH key generation

If you don’t already have an SSH key, you must generate a new SSH key to use for authentication. If you’re unsure whether you already have an SSH key, you can check for existing keys. For more information, see «Checking for existing SSH keys.»

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. You must connect your hardware security key to your computer when you authenticate with the key pair. For more information, see the OpenSSH 8.2 release notes.

If you don’t want to reenter your passphrase every time you use your SSH key, you can add your key to the SSH agent, which manages your SSH keys and remembers your passphrase.

Generating a new SSH key

Paste the text below, substituting in your GitHub email address.

Note: If you are using a legacy system that doesn’t support the Ed25519 algorithm, use:

This creates a new SSH key, using the provided email as a label.

When you’re prompted to «Enter a file in which to save the key,» press Enter. This accepts the default file location.

At the prompt, type a secure passphrase. For more information, see «Working with SSH key passphrases.»

Adding your SSH key to the ssh-agent

Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key. When adding your SSH key to the agent, use the default macOS ssh-add command, and not an application installed by macports, homebrew, or some other external source.

Start the ssh-agent in the background.

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.

First, check to see if your

/.ssh/config file exists in the default location.

If the file doesn’t exist, create the file.

/.ssh/config file, then modify the file to contain the following lines. 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.

Note: If you chose not to add a passphrase to your key, you should omit the UseKeychain line.

Note: If you see an error like this

add an additional config line to your Host * section:

Add your SSH private key to the ssh-agent and store your passphrase in the keychain. 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.

Add the SSH key to your account on GitHub. For more information, see «Adding a new SSH key to your GitHub account.»

If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys.

Ensure the ssh-agent is running. You can use the «Auto-launching the ssh-agent» instructions in «Working with SSH key passphrases», or start it manually:

Add your SSH private key to the ssh-agent. 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.

Add the SSH key to your account on GitHub. For more information, see «Adding a new SSH key to your GitHub account.»

Start the ssh-agent in the background.

Add your SSH private key to the ssh-agent. 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.

Add the SSH key to your account on GitHub. For more information, see «Adding a new SSH key to your GitHub account.»

Generating a new SSH key for a hardware security key

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. For more information, see «Error: Unknown key type.»

Insert your hardware security key into your computer.

Paste the text below, substituting in the email address for your account on GitHub.

Note: If the command fails and you receive the error invalid format or feature not supported, you may be using a hardware security key that does not support the Ed25519 algorithm. Enter the following command instead.

When you are prompted, touch the button on your hardware security key.

When you are prompted to «Enter a file in which to save the key,» press Enter to accept the default file location.

When you are prompted to type a passphrase, press Enter.

Add the SSH key to your account on GitHub. For more information, see «Adding a new SSH key to your GitHub account.»

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Источник

Adding a new SSH key to your GitHub account

To configure your account on GitHub.com to use your new (or existing) SSH key, you’ll also need to add the key to your account.

Before adding a new SSH key to your account on GitHub.com, you should have:

After adding a new SSH key to your account on GitHub.com, you can reconfigure any local repositories to use SSH. For more information, see «Switching remote URLs from HTTPS to SSH.»

Note: GitHub is improving security by dropping older, insecure key types.

DSA keys ( ssh-dss ) are no longer supported. Existing keys will continue to function through March 15, 2022. You cannot add new DSA keys to your user account on GitHub.com.

RSA keys ( ssh-rsa ) with a valid_after before November 2, 2021 may continue to use any signature algorithm. RSA keys generated after that date must use a SHA-2 signature algorithm. Some older clients may need to be upgraded in order to use SHA-2 signatures.

Copy the SSH public key to your clipboard.

If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

In the upper-right corner of any page, click your profile photo, then click Settings. как создать ssh key github windows 10

In the user settings sidebar, click SSH and GPG keys. как создать ssh key github windows 10

Click New SSH key or Add SSH key. как создать ssh key github windows 10

In the «Title» field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key «Personal MacBook Air».

Paste your key into the «Key» field. как создать ssh key github windows 10

Click Add SSH key. как создать ssh key github windows 10

If prompted, confirm your GitHub password. как создать ssh key github windows 10

Copy the SSH public key to your clipboard.

If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

In the upper-right corner of any page, click your profile photo, then click Settings. как создать ssh key github windows 10

In the user settings sidebar, click SSH and GPG keys. как создать ssh key github windows 10

Click New SSH key or Add SSH key. как создать ssh key github windows 10

In the «Title» field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key «Personal MacBook Air».

Paste your key into the «Key» field. как создать ssh key github windows 10

Click Add SSH key. как создать ssh key github windows 10

If prompted, confirm your GitHub password. как создать ssh key github windows 10

Copy the SSH public key to your clipboard.

If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.

In the upper-right corner of any page, click your profile photo, then click Settings. как создать ssh key github windows 10

In the user settings sidebar, click SSH and GPG keys. как создать ssh key github windows 10

Click New SSH key or Add SSH key. как создать ssh key github windows 10

In the «Title» field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key «Personal MacBook Air».

Paste your key into the «Key» field. как создать ssh key github windows 10

Click Add SSH key. как создать ssh key github windows 10

If prompted, confirm your GitHub password. как создать ssh key github windows 10

To learn more about GitHub CLI, see «About GitHub CLI.»

Before you can use the GitHub CLI to add an SSH key to your account, you must authenticate to the GitHub CLI. For more information, see gh auth login in the GitHub CLI documentation.

To add an SSH key to your GitHub account, use the ssh-key add subcommand, specifying your public key.

If you generated your SSH key by following the instructions in «Generating a new SSH key», you can add the key to your account with this command.

Источник

Регистрация на Гитхабе. Работа через консоль

как создать ssh key github windows 10

Гитхаб — крупнейший веб-сервис для хостинга IT-проектов и их совместной разработки. Он как раз и основан на системе контроля версий Гит. Кроме размещения кода участники могут общаться, комментировать правки друг друга, а также следить за новостями знакомых. Именно в нём работаем мы в Академии и ученики на интенсивах.

Регистрация и установка

Устанавливаем Гит

Если до этого вы не работали с Гитом, то его нужно установить. Рассмотрим, как это сделать в популярных операционных системах.

Установка в Linux

Установка на Mac

Сперва устанавливаем Homebrew если он у вас ещё не стоит. Также вы можете установить его с помощью команды:

Эта команда установит Гит на ваш компьютер.Чтобы прописать новый путь к установке Гит введите команду: export PATH=/usr/local/bin:$PATH

Установка в Windows

Здесь всё просто. Просто скачайте exe-файл инсталлятора со страницы проекта на Гитхабе и запустите его.

После установки у вас будет как консольная версия (включающая SSH-клиент, который пригодится позднее), так и стандартная графическая.

Регистрация на Гитхабе

Чтобы начать работать с Гитхабом, нужно зарегистрироваться на нём, если вы ещё этого не сделали. Регистрация предельно проста:

Начинаем работу

Устанавливаем SSH-ключи

SSH-ключ нужен чтобы быстро устанавливать соединение с Гитхабом, не вводя пароля. Кроме того, SSH — единственный из сетевых протоколов, предоставляющий доступ и на чтение, и на запись. Два других сетевых протокола (HTTP[S] и Git) в большинстве случаев дают доступ только на чтение, поэтому даже если они вам доступны, вам всё равно понадобится SSH для записи. К тому же SSH — протокол с аутентификацией и шифрованием трафика, что называется «из коробки». Недостаток SSH в том, что, используя его, вы не можете обеспечить анонимный доступ к репозиторию.

Доступ к удалённому репозиторию по SSH — самый распространённый вариант настройки удалённого доступа, быстрый, удобный и безопасный. Настроив авторизацию в SSH по ключам, вы будете избавлены от необходимости вводить пароли для доступа к репозиторию, сохраняя, однако, приемлемый уровень безопасности.

«eval» не является внутренней или внешней командой, исполняемой программой или пакетным файлом.

Если проблема осталась, то рекомендуем воспользоваться программой Git Bash.

Примечание: если вы используете macOS Sierra 10.12.2 или более позднюю версию, то вам нужно будет модифицировать ваш

/.ssh/config файл, чтобы автоматически загрузить ключи в ssh-agent и хранить пароли.

как создать ssh key github windows 10Добавляем ключ на Гитхаб

как создать ssh key github windows 10Результат проверки добавления ключа

Теперь можно клонировать любой доступный репозиторий используя его SSH-ссылку.

как создать ssh key github windows 10Клонируем репозиторий по SSH-ссылке

Более подробное описание работы с Гитхабом мы рассмотрим в статье «Pабота с Гит через консоль»

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *