I've already written about doing this on Windows. Here's the Ubuntu version.
In a terminal, type:
ssh-keygen -t ed25519 -C "your_email@example.com" (also see this if ED25519 is not supported on your system)
When it asks "Enter file in which to save the key ", just press Enter and type a password. You'll be asked for this password later, so don't forget it.
Go to the ~/.ssh folder and open the id_rsa.pub id_ed25519.pub file with a text editor.
Select the entire contents of the file to copy the key.
In your GitHub account, go to the GitHub profile settings (your account's profile setting page. Not a specific project's settings page; go to the GitHub account's settings page).
Select SSH and GPG keys option in the menu on the left.
Click the green "New SSH key" button and paste the key that you copied.
On your local system, type:
git clone git@github.com:yourUserName/yourRepositoryName.git
You may be asked for entering the private key. Type the password you had recently created.
Add these commands to your ~/.bash_aliases file.
alias pushall="git push --all origin"
alias pullall="git pull --all"
alias commit='git add -A && git commit -m '
Save and exit the bash_aliases file.
Type:
source ~/.bash_aliases
to enable the commands you just entered.
Now simply go to the repository you cloned, make some changes to the files, do a commit with:
commit "a small change was made"
and push:
pushall
Tadaaah! Pushing and pulling becomes so much simpler.
No comments:
Post a Comment