AWS S3 bucket webhosted using Github Action
Github Action for deployment of Static-website to AWS S3 Bucket
Everything you need to know about ...
Let’s assume your two Github accounts are named githubPersonal and githubWork, respectively. Create two SSH keys, saving each to a separate file:
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "your_email@associated_with_githubPersonal.com"
# save it as id_rsa_personal when prompted
$ ssh-keygen -t rsa -C "your_email@associated_with_githubWork.com"
# save it as id_rsa_work when prompted
The above commands setup the following files:
Copy the key to your clipboard:
$ pbcopy < ~/.ssh/id_rsa_personal.pub
Add the key to your account:
Repeat the process for your githubWork account.
Create a config file in ~/.ssh/
$ touch config
Edit the file using the text editor of your choice. I used vim - $ vim config:
# githubPersonal
Host personal
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_personal
# githubWork
Host work
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work
Clear currently stored identities:
$ ssh-add -D
Add new keys:
$ ssh-add id_rsa_personal
$ ssh-add id_rsa_work
Test to make sure new keys are stored:
$ ssh-add -l
Test to make sure Github recognizes the keys:
$ ssh -T personal
Hi githubPersonal! You've successfully authenticated, but GitHub does not provide shell access.
$ ssh -T work
Hi githubWork! You've successfully authenticated, but GitHub does not provide shell access.
On Github, create a new repo in your personal account, githubPersonal, called test-personal.
Back on your local machine, create a test directory:
$ cd ~/documents
$ mkdir test-personal
$ cd test-personal
Add a blank “readme.md” file and PUSH to Github:
$ touch readme.md
$ git init
$ git add .
$ git commit -am "first commit"
$ git remote add origin git@personal:githubPersonal/test-personal.git
$ git push origin master
note: Notice how we’re using the custom account, git@personal, instead of git@github.com.
Repeat the process for your githubWork account.
Add some text to the readme.md file in your personal account on Github. Now PULL and merge the changes by running the following command within the test-personal directory:
$ git pull origin master
Again, repeat this for your githubWork account.
Source: https://mherman.org/