22 lines
1.9 KiB
HTML
22 lines
1.9 KiB
HTML
|
<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link type="text/css" rel="stylesheet" href="/style.css"><link type="text/css" rel="stylesheet" href="style.css"><title>Mirrored Gemini content.</title></head><body><h2> Using Git with GitHub (Passwordless Authentication)</h2><p>Since GitHub no longer supports password authentication for Git, here's how to connect using SSH keys:</p><p>1. Generate SSH Key Pair</p><p>Open your terminal and run the following command, replacing `<your_email>` with your actual email address:</p><pre>
|
||
|
This will prompt you for a passphrase (optional) and save the key pair to your local machine (usually `~/.ssh/`).
|
||
|
|
||
|
2. Add Public Key to GitHub
|
||
|
|
||
|
* Go to your GitHub account settings.
|
||
|
* Navigate to the "SSH and GPG keys" section.
|
||
|
* Click "New SSH key" and provide a title for your key.
|
||
|
* Copy the contents of the file `~/.ssh/id_rsa.pub` (public key) and paste it into the key field on GitHub.
|
||
|
* Click "Add SSH key".
|
||
|
|
||
|
3. Verify Connection
|
||
|
|
||
|
In your terminal, run the following command to test the connection:
|
||
|
|
||
|
</pre><p>If successful, you should see a welcome message from GitHub.</p><p>4. Cloning a Repository</p><p>Now you can use the `git clone` command followed by the SSH URL of the repository to clone it locally. You'll find the SSH URL on the repository homepage on GitHub. The URL will look something like `git@github.com:<username>/<repository_name>.git`.</p><p>Example:</p><pre>
|
||
|
Subsequent Pushes
|
||
|
|
||
|
Once you've made changes and added/committed them, you can push them to your remote repository on GitHub using:
|
||
|
|
||
|
</pre><p>Notes:</p><ul><li>Replace `<username>`, `<repository_name>`, and `<branch_name>` with your actual details.</li></ul><ul><li>This guide covers basic usage. Refer to the official [Git documentation](https://git-scm.com/) for more advanced commands.</li></ul></body></html>
|