在Linux上用git来使用Github

    2025年02月22日 字数:1986

要点

Install git

On MX Linux, git is pre-installed.

On other distribution, it may need to install git. Using:

sudo apt install git

Configure git

Add user name and email to the git: (Change according to your situation)

git config --global user.name "esperisto"

git config --global user.email "5539549+esperisto@users.noreply.github.com"

Here the email address should be the noreply email addresss given by Github if you set your email address private.

Create a ssh key

This enables you to link your Github account to your computer or vice versa. With this key, you won't need to enter username and password every time as you use git to communicate with your Github account.

cd

ssh-keygen -t rsa -C "esperisto@gmail.com"

Then open ~/.ssh/id_rsa/id_rsa.pub, copy its content to SSH and GPG keys in Github under Settings.

Clone your repo to your computer

Now you can clone your repo using:

cd

mkdir ~/Github/ # make a folder to store all repos.

git clone git@github.com:esperisto/esperist.github.io.git # clone the repo

Update your remote repo after local files changed

cd ~/Github

git add the-file-you-changed

git commit -m "your commit comment"

git push origin master

TODO Learn command git push

TODO Translate into Chinese and improve wordings

comments powered by Disqus