47 lines
926 B
Markdown
47 lines
926 B
Markdown
# SSH Key Setup for Homelab Git
|
||
|
||
## 1. Generate key with custom name
|
||
|
||
```bash
|
||
ssh-keygen -t ed25519 -C "miczek.r@gmail.com" -f ~/.ssh/id_ed25519_private -N ""
|
||
```
|
||
|
||
Creates:
|
||
- `~/.ssh/id_ed25519_private` (private – never share)
|
||
- `~/.ssh/id_ed25519_private.pub` (public – add to Gitea & GitHub)
|
||
|
||
## 2. Add to SSH config
|
||
|
||
Append to `~/.ssh/config`:
|
||
|
||
```
|
||
Host git.zea.lt
|
||
HostName 127.0.0.1
|
||
Port 2222
|
||
IdentityFile ~/.ssh/id_ed25519_private
|
||
IdentitiesOnly yes
|
||
|
||
Host github.com
|
||
IdentityFile ~/.ssh/id_ed25519_private
|
||
IdentitiesOnly yes
|
||
```
|
||
|
||
## 3. Add public key to remotes
|
||
|
||
```bash
|
||
cat ~/.ssh/id_ed25519_private.pub
|
||
```
|
||
|
||
- **Gitea:** Settings → SSH / GPG Keys → Add Key
|
||
- **GitHub:** Settings → SSH and GPG keys → New SSH key
|
||
|
||
## 4. Trust host keys & push
|
||
|
||
```bash
|
||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||
ssh-keyscan git.zea.lt >> ~/.ssh/known_hosts
|
||
|
||
cd /home/miczek/homelab
|
||
git push -u origin main
|
||
```
|