DEV Community

Cover image for The bare minimum to work with Git
Breno Alves
Breno Alves

Posted on

The bare minimum to work with Git

Whether starting a solo project or working with someone else you got to have your things right.


Name and Email:

The first step to configure Git is to configure your user name and email. We can do so by typing the following lines

git config --global user.name "My Name"
git config --global user.email "My Email"
Enter fullscreen mode Exit fullscreen mode

SSH key

go to ssh folder on your computer and create a new one

cd ~/.ssh

ssh-keygen -t ed25519 -C "My email"
Enter fullscreen mode Exit fullscreen mode

you'll be asked many questions that you should read first but you can ignore those and just press enter for everyone.

now run the following command:

cat ./id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

now you can get your public key and use it on Github/Gitlab/GitBucket. I'll be showing you how to do it on Github.

Showing Settings button

Showing SSH/GPG button

Now use the public key we got before.

Using previous key


Every time you feel needed to edit your .gitconfig you can do so by running the following line on your terminal.

git config --global --edit
Enter fullscreen mode Exit fullscreen mode

Cool stuff

There is a lot of cool stuff we can configure on Git but I'll list some of them here and leave them for a new article.

Configuring the initial branch

git config --global init.defaultBranch master
Enter fullscreen mode Exit fullscreen mode

Configuring signature with GPG/SSH key

Link: Docs

Oldest comments (0)