Github ssh настройка linux

cham11ng / git-ssh-configuration.md

We can check if Git is installed by typing git —version in your Terminal or Git Bash (Windows) respectively.

Download Git for Windows from this link https://git-scm.com/downloads

Configuration

Open your Terminal or Git Bash(Windows).

$ ssh -v usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] [user@]hostname [command]

List the contents of your ~/.ssh directory.

If we have already setup default identity, we can see two id_ files

$ ls -a ~/.ssh . .. id_rsa id_rsa.pub known_hosts

The system adds keys for all identities to the /home//.ssh (Linux) or /c/Users//.ssh (Windows) directory. The following procedure creates a default identity.

Hit ssh-keygen command on Terminal or Git Bash.

$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/yourname>/.ssh/id_rsa):

Press enter to accept the default key and location or we can set somewhere else.

We enter and re-enter a passphrase when prompted. Unless you need a key for a process such as script, you should always provide a passphrase. The command creates your default identity with its public and private keys

$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/yourname>/.ssh/id_rsa): Created directory '/c///.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/yourname>/.ssh/id_rsa. Your public key has been saved in /c/Users/yourname>/.ssh/id_rsa.pub. The key fingerprint is: SHA256:+V6cLhFWngIFC+TdHwQHxJP39lsZUWnP6TDj1/7hBVA yourname>@yourname> The key's randomart image is: +---[RSA 2048]----+ | .o .==+o E +| | . o.o+oo. + | | . o..=oo..+| | .+.o*ooo| | S. oo.*.+| | . o =+| | ..+ .o+| | ..o ..+| | . .o| +----[SHA256]-----+

List the contents of your ~/.ssh directory.

$ ls ~/.ssh . .. id_rsa id_rsa.pub known_hosts

Ensure ssh-agent is enabled:

$ eval "$(ssh-agent -s)" # Agent pid 59566

Add your SSH key to the ssh-agent

  • Find and take a note of your public key fingerprint. If you’re using OpenSSH 6.7 or older:
$ ssh-add -l # 2048 a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d /Users//.ssh/id_rsa (RSA) If you are using OpenSSH 6.8 or newer: $ ssh-add -l -E md5 # 2048 MD5:a0:dd:42:3c:5a:9d:e4:2a:21:52:4e:78:07:6e:c8:4d /Users//.ssh/id_rsa (RSA)
$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2zeZVIph1tP0UZJ007AC1OWqThpYjDlao1PlQnZbrSMeS8LXkU/nMxuZdAv+2JeqhezOtb6/e8e50NOTWB9Z2O8thCMwc29cp6C+vHL2oWQYMcCOuT34/R2yDEOMQ5nkIZ1fVFJNCTIZUaKjyaHX89w0v2p9cMsZ1q36w9lEdKXs8N5fuN/6rAy3JQgMcbD+dDd0cWpP8CLiUyNCq32xwqhX+nS1P43AgOQdLpX74uljwr7rE2CmrJQkvh/m+h68tv8+mLMGJtg5cJ+doZ+9r9yPhKJYGEsW4bL+8sSRQn3gJWUib8xhOgaWrMfXj+94o1KbcI12lK772GNyP74rX yourname>@yourname>

Copy this output to respective SSH keys setting.

You have now successfully configured SSH for Git in Windows/Linux/Mac OS.

Источник

Github ssh настройка linux

  • Top developer relations trends for building stronger teams Learn about enterprise trends for optimizing software engineering practices, including developer relations, API use, community .
  • 5 noteworthy challenges of automotive software development Modern cars are loaded with technology, but creating in-vehicle applications isn’t always a cakewalk. Here are five unique .
  • New AWS service targets data security, genAI feature to come The cloud provider’s new service helps employees within organizations be more productive while securing their work. The vendor .
  • The potential of ChatGPT for software testing ChatGPT can help software testers write tests and plan coverage. How can teams anticipate both AI’s future testing capabilities .
  • Retail companies gain DORA metrics ROI from specialist tools DORA metrics and other measures of engineering efficiency are popping up in add-ons to existing DevOps tools. But third-party .
  • Scrum master certification exam questions and answers Are you ready for the Scrum master certification exam? Test yourself on these 10 tough Scrum master exam questions and answers.
  • Prices for cloud infrastructure soar 30% Tough macroeconomic conditions as well as high average selling prices for cloud computing and storage servers have forced .
  • Deploy a low-latency app with AWS Local Zones in 5 steps Once you decide AWS Local Zones are right for your application, it’s time for deployment. Follow along in this step-by-step video.
  • HPE bets big on public cloud offering for AI HPE is entering the AI public cloud provider market — but is it ready? Read more about its AI offerings for HPE GreenLake and .
  • Risk & Repeat: How bad is Clop’s MoveIt Transfer campaign? Clop’s data theft and extortion campaign against MoveIt Transfer customers marks some of the most high-profile threat activity .
  • Clop’s MoveIt Transfer attacks lead to mixed results Clop’s data theft extortion campaign against MoveIt Transfer customers has apparently compromised hundreds of organizations. But .
  • For stronger public cloud data security, use defense in depth The amount of cloud-resident data is increasing — and so are the number of challenges to sufficiently secure it, especially .
  • AWS Control Tower aims to simplify multi-account management Many organizations struggle to manage their vast collection of AWS accounts, but Control Tower can help. The service automates .
  • Break down the Amazon EKS pricing model There are several important variables within the Amazon EKS pricing model. Dig into the numbers to ensure you deploy the service .
  • Compare EKS vs. self-managed Kubernetes on AWS AWS users face a choice when deploying Kubernetes: run it themselves on EC2 or let Amazon do the heavy lifting with EKS. See .

Источник

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.

About addition of SSH keys to your account

You can access and write data in repositories on GitHub.com using SSH (Secure Shell Protocol). When you connect via SSH, you authenticate using a private key file on your local machine. For more information, see «About SSH.»

You can also use SSH to sign commits and tags. For more information about commit signing, see «About commit signature verification.»

After you generate an SSH key pair, you must add the public key to GitHub.com to enable SSH access for your account.

Prerequisites

Before adding a new SSH key to your account on GitHub.com, complete the following steps.

  1. Check for existing SSH keys. For more information, see «Checking for existing SSH keys.»
  2. Generate a new SSH key and add it to your machine’s SSH agent. For more information, see «Generating a new SSH key and adding it to the ssh-agent.»

Adding a new SSH key to your account

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

Note: GitHub improved security by dropping older, insecure key types on March 15, 2022.

As of that date, DSA keys ( ssh-dss ) are no longer supported. You cannot add new DSA keys to your personal 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.

  1. 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.

Tip: If pbcopy isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

Tip: With Windows Subsystem for Linux (WSL), you can use clip.exe . Otherwise if clip isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

$ cat ~/.ssh/id_ed25519.pub # Then select and copy the contents of the id_ed25519.pub file # displayed in the terminal to your clipboard

Tip: Alternatively, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

Screenshot of GitHub's account menu showing options for users to view and edit their profile, content, and settings. The menu item

In the upper-right corner of any page, click your profile photo, then click Settings.

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.

At present, you can only use GitHub CLI to add SSH authentication keys, you cannot add SSH signing keys.

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

To include a title for the new key, use the -t or —title flag.

gh ssh-key add KEY-FILE --title "personal laptop"

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

gh ssh-key add ~/.ssh/id_ed25519.pub

Further reading

Источник

Настройка Git

В основе GitHub лежит система управления версиями с открытым кодом (VCS) под названием Git. Git отвечает за все, что связано с GitHub и происходит локально на вашем компьютере.

С помощью Git

Для работы с Git в командной строке необходимо скачать, установить и настроить Git на компьютере. Также вы можете установить GitHub CLI для работы с GitHub из командной строки. Дополнительные сведения см. в разделе Сведения о GitHub CLI.

Если вы хотите работать с Git локально, но не хотите использовать командную строку, можно скачать и установить клиент GitHub Desktop . Дополнительные сведения см. в разделе Установка и настройка GitHub Desktop.

Если вам не требуется работать с файлами локально, множество связанных с Git действий можно выполнять с помощью GitHub непосредственно в браузере:

Настройка Git

  1. Установите на устройство с Chrome OS эмулятор терминала, например Termux, из Google Play Маркет.
  2. Установите Git из установленного эмулятора терминала. Например, в Termux введите apt install git и затем y при появлении запроса.

Проверка подлинности с помощью GitHub из Git

При подключении к репозиторию GitHub из Git необходимо пройти проверку подлинности в GitHub с использованием протокола HTTPS или SSH.

Примечание. Для проверки подлинности в GitHub можно использовать GitHub CLI для HTTP или SSH. Дополнительные сведения см. на веб-сайте gh auth login .

Подключение по протоколу HTTPS (рекомендуется)

При клонировании по протоколу HTTPS вы можете кэшировать учетные данные GitHub в Git с помощью вспомогательного приложения для управления учетными данными. Дополнительные сведения см. в разделах Сведения об удаленных репозиториях и Кэширование учетных данных GitHub в Git.

Подключение по протоколу SSH

При клонировании по протоколу SSH необходимо создать ключи SSH на каждом компьютере, который будет использоваться для отправки или извлечения данных из GitHub. Дополнительные сведения см. в разделах Сведения об удаленных репозиториях и Создание нового ключа SSH и его добавление в ssh-agent.

Дальнейшие действия

Настройка Git и GitHub завершена. Теперь вы можете создать репозиторий, в котором будут размещаться ваши проекты. В репозитории вы можете хранить резервные копии своего кода и обеспечить возможность доступа к нему пользователям по всему миру.

  • Создание репозитория для проекта позволяет хранить код на GitHub. Таким образом вы получаете резервную копию результатов работы, которую можно предоставить другим разработчикам. Дополнительные сведения см. в разделе Создание репозитория..
  • Создание вилки репозитория позволит вносить изменения в другой репозиторий, не затрагивая исходный. Дополнительные сведения см. в разделе Ветвление репозитория.
  • Каждый репозиторий на GitHub принадлежит пользователю или организации. Вы можете взаимодействовать с людьми, репозиториями и организациями, подписавшись на них на GitHub. Дополнительные сведения см. в разделе Налаживание социальных связей.
  • У GitHub большое сообщество поддержки, где можно обратиться за помощью и поговорить с людьми со всего мира. Присоединиться к беседе можно в GitHub Community.

Источник

Читайте также:  Управление разделами дисков linux
Оцените статью
Adblock
detector