Update ssh key generation to generate keys for all hosts
parent
8db3cebb14
commit
4e413f26f9
|
@ -52,7 +52,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Run key creation
|
- name: Run key creation
|
||||||
run: echo "test\n\n" | make create_personal_ssh_github_key
|
run: echo "test\n\n\n\n\n\n\n\n" | make create_personal_ssh_keys
|
||||||
env:
|
env:
|
||||||
DOTFILES_CI: 1
|
DOTFILES_CI: 1
|
||||||
stylua:
|
stylua:
|
||||||
|
|
41
Makefile
41
Makefile
|
@ -80,6 +80,23 @@ define write_git_ssh_config_entry
|
||||||
@echo " IdentityFile $3" >> $(SSH_CONFIG_FILE)
|
@echo " IdentityFile $3" >> $(SSH_CONFIG_FILE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Creates a new ssh key and saves it to config
|
||||||
|
# Takes 3 parameters:
|
||||||
|
# - Email
|
||||||
|
# - Host name (ex. codeberg)
|
||||||
|
# - Host (ex. codeberg.org)
|
||||||
|
define create_personal_git_ssh_key
|
||||||
|
ssh-keygen -f $(PERSONAL_SSH_KEYS_HOME)/id_ed25519_$2 -t ed25519 -b 4096 -C $1
|
||||||
|
@echo "Personal $2 key created!"
|
||||||
|
@echo "Copy public key by running:"
|
||||||
|
@echo ""
|
||||||
|
@echo "cat $(PERSONAL_SSH_KEYS_HOME)/id_ed25519_$2.pub | $(COPY_TOOL)"
|
||||||
|
@echo ""
|
||||||
|
@echo "Open SSH page on $3"
|
||||||
|
@echo "and paste copied public key"
|
||||||
|
$(call write_git_ssh_config_entry,$3,,$(PERSONAL_SSH_KEYS_HOME)/id_ed25519_$2)
|
||||||
|
endef
|
||||||
|
|
||||||
.PHONY: bootstrap
|
.PHONY: bootstrap
|
||||||
bootstrap: check_os
|
bootstrap: check_os
|
||||||
@echo "Bootstrapped everything!"
|
@echo "Bootstrapped everything!"
|
||||||
|
@ -215,26 +232,22 @@ prepare_scripts_cache_dir: check_os
|
||||||
.PHONY: clone_personal_vimwiki
|
.PHONY: clone_personal_vimwiki
|
||||||
clone_personal_vimwiki: check_os
|
clone_personal_vimwiki: check_os
|
||||||
@echo "Cloning personal vimwiki"
|
@echo "Cloning personal vimwiki"
|
||||||
@git clone git@github.com:esensar/vimwiki.wiki.git ~/vimwiki
|
@git clone git@ensarsarajcic.com:esensar/vimwiki.wiki.git ~/vimwiki
|
||||||
|
|
||||||
.PHONY: prepare_ssh_dir
|
.PHONY: prepare_ssh_dir
|
||||||
prepare_ssh_dir: check_os
|
prepare_ssh_dir: check_os
|
||||||
@echo "Creating ssh directories"
|
@echo "Creating ssh directories"
|
||||||
@mkdir -p $(HOME)/.ssh/Personal
|
@mkdir -p $(HOME)/.ssh/Personal
|
||||||
|
|
||||||
.PHONY: create_personal_ssh_github_key
|
.PHONY: create_personal_ssh_keys
|
||||||
create_personal_ssh_github_key: check_os prepare_ssh_dir
|
.ONESHELL:
|
||||||
@echo "Creating personal GitHub key"
|
create_personal_ssh_keys: check_os prepare_ssh_dir
|
||||||
@read -p "Enter your email: " email; \
|
@echo "Creating personal ssh keys"
|
||||||
ssh-keygen -f $(PERSONAL_SSH_KEYS_HOME)/id_rsa_github -t rsa -b 4096 -C $$email
|
@read -p "Enter your email: " email;
|
||||||
@echo "Personal GitHub key created!"
|
$(call create_personal_git_ssh_key,$$email,personal_git,git.ensarsarajcic.com);
|
||||||
@echo "Copy public key by running:"
|
$(call create_personal_git_ssh_key,$$email,codeberg,codeberg.org);
|
||||||
@echo ""
|
$(call create_personal_git_ssh_key,$$email,sourcehut,git.sr.ht);
|
||||||
@echo "cat $(PERSONAL_SSH_KEYS_HOME)/id_rsa_github.pub | $(COPY_TOOL)"
|
$(call create_personal_git_ssh_key,$$email,github,github.com);
|
||||||
@echo ""
|
|
||||||
@echo "Open: https://github.com/settings/ssh/new"
|
|
||||||
@echo "and paste copied public key"
|
|
||||||
$(call write_git_ssh_config_entry,github.com,,$(PERSONAL_SSH_KEYS_HOME)/id_rsa_github)
|
|
||||||
|
|
||||||
.PHONY: prepare_fish_shell
|
.PHONY: prepare_fish_shell
|
||||||
prepare_fish_shell: check_os
|
prepare_fish_shell: check_os
|
||||||
|
|
|
@ -46,9 +46,9 @@ make bootstrap
|
||||||
|
|
||||||
After installation optionally check out `installed_packages` directory for packages to install using `clone-installation`.
|
After installation optionally check out `installed_packages` directory for packages to install using `clone-installation`.
|
||||||
|
|
||||||
This repository also provides a simple way to generate main personal ssh key to be used with GitHub:
|
This repository also provides a simple way to generate personal ssh keys to be used with used git hosts:
|
||||||
```
|
```
|
||||||
make create_personal_ssh_github_key
|
make create_personal_ssh_keys
|
||||||
```
|
```
|
||||||
|
|
||||||
It is recommended to also clone `vimwiki` and use it (this is a private repository and applies only to owner):
|
It is recommended to also clone `vimwiki` and use it (this is a private repository and applies only to owner):
|
||||||
|
|
Loading…
Reference in New Issue