Git is the distributed version control system. Git is responsible for keeping track of changes to content (usually source code files), and it provides mechanisms for sharing that content with others.
- As always, you’ll first want to ensure that the existing packages are up to date before proceeding with the installation:
-> dnf -y update
- Then, you can install git with this command:
-> dnf -y install git
- Once complete, git will be installed and ready to use!
As of the writing of this tutorial, the current version of Git available in the Liquid Web dnf repositories is version 2.5.0. You can check the version of git that was installed by running the following command:
-> git --version
- To prevent any commit errors, it’s a good idea to set up your user for git (use the –global option to specify global configuration settings).
git config --global user.name "sampleuser"
git config --global user.email "email@example.com"
- You can verify the configuration changes by viewing the .gitconfig:
git config --list
- That should produce output similar to the following:
[root@host ~]# git config --list
- Generate ssh keyssh-keygen//ssh is both a program and a network protocol.Its allows a user to run commands on a machine’s command prompt without them being physically present near the machine.Enter passphrase (empty for no passphrase): [press enter]
Enter same passphrase again: [press enter]
- copy the ssh key and add it in the github repository.
- Intialize empty git repository$ git init
- enter every file to added$ git add .
- $ git commit -m ‘first commit’
- $ git remote add origin firstname.lastname@example.org:Username/Repository.git
- $ git push -u origin master// ‘git commit’ records changes made to the repository while ‘git push’ updates the remote reference along with the changes.