docs: setup instructions on how to use SSH with gitea
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Getting Started with Git
|
||||
|
||||
## Step 1: Add Your Public SSH Key to Gitea
|
||||
|
||||
- Ensure your local machine's public SSH key is added to your Gitea account settings.
|
||||
- Navigate to [Gitea web interface](https://git.rodneyosodo.com).
|
||||
- Go to `Settings` > `SSH/GPG Keys` and click `Add Key`.
|
||||
- Paste the contents of your public key file (e.g., `~/.ssh/id_rsa.pub`) into the Content box and save.
|
||||
|
||||
## Step 2: Configure Your Local SSH Client
|
||||
|
||||
- The critical step is configuring your local SSH client to use the [cloudflared](https://github.com/cloudflare/cloudflared) daemon as a proxy for the Gitea SSH hostname. This allows your SSH client to establish the connection through the Cloudflare tunnel instead of trying a direct connection.
|
||||
- Edit your local SSH configuration file (`~/.ssh/config`) and add the following entries:
|
||||
|
||||
```config
|
||||
Host git.rodneyosodo.com
|
||||
HostName gitssh.rodneyosodo.com
|
||||
Port 4021
|
||||
User git
|
||||
IdentityFile ~/.ssh/id_rsa # Path to your private SSH key
|
||||
ProxyCommand /usr/bin/cloudflared access ssh --hostname %h
|
||||
```
|
||||
|
||||
- Make sure to replace `/usr/bin/cloudflared` with the actual path to the cloudflared executable on your local machine.
|
||||
|
||||
## Step 3: Test the Connection
|
||||
|
||||
You should now be able to use standard Git SSH commands to interact with your Gitea repositories. Gitea will provide clone URLs like `git@git.rodneyosodo.com:<username>/<repo>.git`, which your local SSH config will intercept and route correctly through the tunnel.
|
||||
|
||||
Test the connection:
|
||||
|
||||
```bash
|
||||
ssh -T git@git.rodneyosodo.com
|
||||
```
|
||||
|
||||
You should see a message confirming you have successfully connected to Gitea via SSH.
|
||||
|
||||
```bash
|
||||
Hi there, <username>! You've successfully authenticated with the key named <ssh-key-name>, but Gitea does not provide shell access.
|
||||
If this is unexpected, please log in with password and setup Gitea under another user.
|
||||
```
|
||||
|
||||
Clone a repository:
|
||||
|
||||
```bash
|
||||
git clone git@git.rodneyosodo.com:rodneyosodo/getting-started-git-rodneyosodo.git
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user