use git over ssh

This commit is contained in:
Ray Elliott 2020-09-04 21:19:35 +01:00
parent 407246ca08
commit eac4231c1e
5 changed files with 23 additions and 14 deletions

View File

@ -5,6 +5,3 @@ Development environment base packages:
* lf * lf
* lazygit * lazygit
## TODO
* add ssh keys to user so can use git - how to do securely??

1
files/id_rsa.pub Normal file
View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEwwL1J52P0IuAWa+Ar3tCFOmT3A+V4F6/nz3JwGozCGaPrIqyOW7R3R+Y9UZZrxHYT7pt71lhNDQdN4Elhiix6Zkzrf4ZJRDfcyGvg7ZQGOG2nODybmW0TilnELtfjmtiaJ/2wBxNCiwdZAzFCb0kNKyXsUqx3b4NA7nKoxlVEdK1SZyaqwpe4oO6eoj6Nl2fPpLJ7Xq7VX83UJJPofPs3qUYOB2ywhKMljjbHDbQrRr+7Z3vQwmSs8sGI6qh1OHR7HZ2x8kVK507uwKXKPBlLGVKT2RDTslQiooNuuInBD/+DDegme+2arfnHIKB+GWK4Sun6aeN8UcMqA03GsRj dev-scripts@dev

2
files/known_hosts Normal file
View File

@ -0,0 +1,2 @@
|1|3oVXnt29xONh6+jmV3anxv2jUlE=|6FMJKCQKcgMN0RKsZPt4QcX/Dcw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEon87+GR5+/I0SwUrsf7TlKQFXkgyYxqnHC4YyZ2i9LbuCrGi3hPibV1tZL4FTyqrI87+uxnZRDznXY2lpLP8Y=
|1|3oVXnt29xONh6+jmV3anxv2jUlE=|6FMJKCQKcgMN0RKsZPt4QcX/Dcw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEon87+GR5+/I0SwUrsf7TlKQFXkgyYxqnHC4YyZ2i9LbuCrGi3hPibV1tZL4FTyqrI87+uxnZRDznXY2lpLP8Y=

View File

@ -53,7 +53,7 @@ npm install -g neovim
python2 -m pip install --user --upgrade pynvim python2 -m pip install --user --upgrade pynvim
python3 -m pip install --user --upgrade pynvim python3 -m pip install --user --upgrade pynvim
python3 -m pip install --user --upgrade neovim-remote python3 -m pip install --user --upgrade neovim-remote
git clone https://git.rayelliott.dev/dots/nvim.git $_home_dir/.config/nvim git clone ssh://git@git.rayelliott.dev:3222/dots/nvim.git $_home_dir/.config/nvim
curl -fLo $_home_dir/.config/nvim/autoload/plug.vim --create-dirs \ curl -fLo $_home_dir/.config/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim --headless +PlugInstall +qall nvim --headless +PlugInstall +qall
@ -65,7 +65,7 @@ lf config
if [ -e "$_home_dir/.config/lf" ] ; then if [ -e "$_home_dir/.config/lf" ] ; then
mv "$_home_dir/.config/lf" "$_home_dir/.config/lf-original-$(date +%s)" mv "$_home_dir/.config/lf" "$_home_dir/.config/lf-original-$(date +%s)"
fi fi
git clone https://git.rayelliott.dev/dots/lf.git "$_home_dir/.config/lf" git clone ssh://git@git.rayelliott.dev:3222/dots/lf.git "$_home_dir/.config/lf"
EOSSH EOSSH

View File

@ -2,9 +2,20 @@
_home_dir="/home/$user" _home_dir="/home/$user"
echo "Adding user: $user" echo "Configuring ssh keys .."
ssh $ssh mkdir -p "$_home_dir/.ssh"
scp files/private/id_rsa "$ssh:$_home_dir/.ssh/"
scp files/id_rsa.pub "$ssh:$_home_dir/.ssh/"
scp files/known_hosts "$ssh:$_home_dir/.ssh/"
ssh -T $ssh << EOSSH ssh -T $ssh << EOSSH
cp /root/.ssh/authorized_keys "$_home_dir/.ssh/authorized_keys"
chown -R "$user:$group" "$_home_dir/.ssh"
# add git.rayelliott.dev to known hosts
echo "Adding user: $user"
if [ -f /etc/locale.gen ] && command -v locale-gen ; then if [ -f /etc/locale.gen ] && command -v locale-gen ; then
echo 'en_GB.UTF-8 UTF-8' > /etc/locale.gen echo 'en_GB.UTF-8 UTF-8' > /etc/locale.gen
locale-gen locale-gen
@ -22,30 +33,28 @@ ssh -T $ssh << EOSSH
echo "$user:$user_pass" | chpasswd echo "$user:$user_pass" | chpasswd
usermod -aG sudo "$user" usermod -aG sudo "$user"
mkdir -p "$_home_dir/.ssh"
cp /root/.ssh/authorized_keys "$_home_dir/.ssh/authorized_keys"
chown -R "$user:$group" "$_home_dir/.ssh"
echo "Cloning configuration files .." echo "Cloning configuration files .."
su "$user" su --login "$user"
git config --global user.name rayelliott
git config --global user.email dev@rayelliott.dev
mkdir -p "$_home_dir/.config" mkdir -p "$_home_dir/.config"
if [ -e "$_home_dir/.config/profile" ] ; then if [ -e "$_home_dir/.config/profile" ] ; then
mv "$_home_dir/.config/profile" "$_home_dir/.config/profile-original-$(date +%s)" mv "$_home_dir/.config/profile" "$_home_dir/.config/profile-original-$(date +%s)"
fi fi
git clone https://git.rayelliott.dev/dots/profile.git "$_home_dir/.config/profile" git clone ssh://git@git.rayelliott.dev:3222/dots/profile.git "$_home_dir/.config/profile"
"$_home_dir/.config/profile/install.sh" "$_home_dir/.config/profile/install.sh"
if [ -e "$_home_dir/.config/tmux" ] ; then if [ -e "$_home_dir/.config/tmux" ] ; then
mv "$_home_dir/.config/tmux" "$_home_dir/.config/tmux-original-$(date +%s)" mv "$_home_dir/.config/tmux" "$_home_dir/.config/tmux-original-$(date +%s)"
fi fi
git clone https://git.rayelliott.dev/dots/tmux.git "$_home_dir/.config/tmux" git clone ssh://git@git.rayelliott.dev:3222/dots/tmux.git "$_home_dir/.config/tmux"
"$_home_dir/.config/tmux/install.sh" "$_home_dir/.config/tmux/install.sh"
if [ -e "$_home_dir/.config/zsh" ] ; then if [ -e "$_home_dir/.config/zsh" ] ; then
mv "$_home_dir/.config/zsh" "$_home_dir/.config/zsh-original-$(date +%s)" mv "$_home_dir/.config/zsh" "$_home_dir/.config/zsh-original-$(date +%s)"
fi fi
git clone https://git.rayelliott.dev/dots/zsh.git "$_home_dir/.config/zsh" git clone ssh://git@git.rayelliott.dev:3222/dots/zsh.git "$_home_dir/.config/zsh"
"$_home_dir/.config/zsh/install.sh" "$_home_dir/.config/zsh/install.sh"
EOSSH EOSSH