When you would like to clone your own git repository or others git repositories, the best way to do this is to use the ssh mode.
This mode is required when you need to commit some code or documentation to a repo of your choice.
First, you need to have the ssh-keygen tool installed on Haiku.
In a Terminal type:
which ssh-keygen
If this command is already installed, then fine, else you will need to install the openssh package:
pkgman install openssh
We are now ready to do the setup:)
The first step is to create ssh public/private keys.
In a Terminal type:
ssh-keygen
Go into the "/boot/home/config/settings/ssh" folder and verify that both private and public keys were created:
cd /boot/home/config/settings/ssh
ls
Now connect to your github account and click on the "Settings" section:
Select "SSH and GPG keys":
Define a new SSH key with "New SSH key":
From the Terminal, display the content of your public key:
cat id_ed25519.pub
Go back to your github account preferences, and enter the below information:
Validate with "Add SSH key".
In the Terminal, type the below commands to recognize your new key:
eval "$(ssh-agent -s)"
ssh-add /boot/home/config/settings/ssh/id_ed25519
ssh-keyscan -t ed25519 github.com >> /boot/home/config/settings/ssh/known_hosts
Now test the authentication key:
ssh -T git@github.com
If the message displayed is indicating "successfully authenticated", it means your ssh key setup is now effective and fine:)
To clone your favorite git repo, open a Terminal and type:
git clone git@github.com:DigitalBox98/litehtml
where:
Verify the content of your cloned repo:
cd litehtml/
ls -l
git remote -v
The repo is now accessible via SSH, and you can proceed with the standard pull/commit/push commands:)
I hope you have found this article useful, you can put a comment below in case you would like to share your experience on that topic.