To install git for the current user, run:
Creating a Git repository
To create a new git repository, in the current directory, do:
A message should confirm the creation of the repository:
Initialized empty Git repository in /root/test/.git/
Getting a Git repository
To clone an existing git repository, do:
$ git clone https://github.com/MunGell/awesome-for-beginners.git
This will create a new folder
awesome-for-beginners. To go to the new folder:
$ cd awesome-for-beginners
After you’ve made some changes, commit them to the git repository, to permanently save the current version.
To add all changed, files to the commit, do:
To add individual, changed files to the commit, do:
To see all files, that will be added to the commit, do:
If you like to clear the staging area, and start again, do:
To commit the changes you’ve made, make sure that you’ve added them to the staging area with
git add . and reviewed all changes with
git status. Now go ahead, and commit (save) the changes:
$ git commit -m "file: revised instructions"
It’s good practice, to add short but clear commit messages.
Tips and tricks
Using multiple SSH keys
~/.ssh/config and define all domains, and keys you’d like to use.
Error: gpg failed to sign the data
If you’re facing issues signing with gpg, here’s what you can do:
$ git commit -m "initial commit"
error: gpg failed to sign the data
fatal: failed to write commit object
Double-check that gpg is working:
$ echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
gpg: signing failed: No pinentry
gpg: [stdin]: clear-sign failed: No pinentry
Note: It’s not working; Looks like it cannot find pinentry.
Find out the location of pinentry:
# Find out pinentry location
$ which pinentry
Stop the running gpg daemon:
# kill running daemon
# run new daemon
gpg-agent --pinentry-program=/run/current-system/profile/bin/pinentry --daemon