git Archives - The Linux GURUS https://thelinuxgurus.com/tag/git/ Learn Linux & DevOPS from THE LINUX GURUS Sun, 16 Feb 2020 05:15:52 +0000 en-US hourly 1 https://i0.wp.com/thelinuxgurus.com/wp-content/uploads/2020/01/cropped-thelinuxgurus_transparent_name.png?fit=32%2C32&ssl=1 git Archives - The Linux GURUS https://thelinuxgurus.com/tag/git/ 32 32 148921671 Complete guide to Install Django on Ubuntu https://thelinuxgurus.com/complete-guide-to-install-django-on-ubuntu/ https://thelinuxgurus.com/complete-guide-to-install-django-on-ubuntu/#respond Sun, 16 Feb 2020 05:15:52 +0000 https://thelinuxgurus.com/?p=1114 Django is a free and open-source web framework for python. It is very fast & allows rapid development by developers to create a website with...

The post Complete guide to Install Django on Ubuntu appeared first on The Linux GURUS.

]]>
Django is a free and open-source web framework for python. It is very fast & allows rapid development by developers to create a website with less time as well as efforts. Django is highly scalable & is also very secure, it allows developers to avoid common mistakes leading to serious security threats like XSS, SQL injection, CSRF, etc.

Recommended Read: Simple way to install Git on CentOS/RHEL

Also Read: Complete guide on Git Commands for Beginners

All these features have lead Django to being the most widely used framework. It is now being used by many major organizations to power their websites, like for example Pinterest, Firefox, NASA, Instagram, BitBucket, etc. In this tutorial, we will learn to install Django on Ubuntu.


Install Django on Ubuntu

To install Django on Ubuntu servers, we can use either of the following three methods mentioned below,

1- Install using apt

2- Using PIP

3- Using the Github Packages


1- Install using apt

Django packages are maintained by the default Ubuntu repositories & can be installed using the Ubuntu package manager i.e. apt or apt-get. Use the following command to install Django on ubuntu,

$ sudo apt-get install python3-django

This will install Django compatible with python 3. But if you need to install Django for python 2, which we don’t recommend since python 2 is no longer supported, you can use the following command,

$ sudo apt-get install python-django


2- Install Django using PIP

We have already discussed how to install PIP on the Ubuntu system, please refer to the article if you need to install PIP. You can also use the following command to install PIP,

$ sudo apt-get install python3-pip

So now to install Django using pip, the command is,

$ pip3 install django

We will now have a stable version of Django installed on our system.


3- Install Django using the Github Packages

Any of the two above methods should work for you for installing a stable version of Django but if for some reason you need to use the development version of Django, you need to use the package files available on the Github repository. So before we process with this method, we must have GIT & PIP both installed onto our system. Install PIP & GIT with the following commands,

$ sudo apt-get install python3-pip

$ sudo apt-get install git

Now we can use git to clone the Django repository to our local system,

$ mkdir ~/django

$ cd ~/django

$ git init

$ git clone git://github.com/django/django

Now we need to install Django using the pip command,

$ pip install -e ~/django

This command will now install Django on Ubuntu systems. With this, we end our tutorial on how to install Django on Ubuntu, please do let us know if you have any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Complete guide to Install Django on Ubuntu appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/complete-guide-to-install-django-on-ubuntu/feed/ 0 1114
Simple way to install Git on CentOS/RHEL https://thelinuxgurus.com/simple-way-to-install-git-on-centos-rhel/ https://thelinuxgurus.com/simple-way-to-install-git-on-centos-rhel/#comments Thu, 06 Feb 2020 08:55:34 +0000 https://thelinuxgurus.com/?p=1109 Git is one an open-source, distributed version controlling system & is used for tracking changes in files/code between multiple peoples/locations. It is the most widely...

The post Simple way to install Git on CentOS/RHEL appeared first on The Linux GURUS.

]]>
Git is one an open-source, distributed version controlling system & is used for tracking changes in files/code between multiple peoples/locations. It is the most widely used version controlling system that is being used by millions of users & organizations.

Recommended Read: Install Git on Ubuntu – The Easy Way

Also Read: How to install Java on CentOS & RHEL

It is a distributed system that allows every repository on every system to act as a full-fledged repository itself with complete history & version tracking capabilities. In this tutorial, we will learn to install it on CentOS/RHEL systems. So this tutorial should work for all CentOS/RHEL versions. Here we will be discussing two methods to install git on Linux systems,

1- Using default package manager i.e. yum

2- Using source packages


Install Git on CentOS /RHEL

1- Using default package manager

Git packages are maintained on the default package repositories of CentOS. They might not be the latest packages but they will be stable packages. So to install git on CentOS using yum, we can use the following command,

# yum install git

This would install git on CentOS/RHEL. If for some reason, you need the latest or any particular version of the git, then we recommend that you use the second method for git installation.


2- Using source packages

Now to install git using the source packages, we must have all the required packages for the compilation of git source package. Use the following commands to install the required packages,

# yum install gcc perl-ExtUtils-MakeMaker

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

Next, we can either download a particular version or can also install the latest git version. We will be installing the latest packages, download the latest packages with the following command,

$ wget https://github.com/git/git/archive/master.zip

The latest packages will always be available at the mentioned URL. Next, we need to unzip the downloaded package,

$ unzip master.zip

$ cd master

Next, compile & install git with the following command,

$ make prefix=/usr/local all

$ sudo make prefix=/usr/local install

This will install git on Linux machine (CentOS or RHEL). Refer to git commands cheat sheet here to learn about git usage & commands. We end this tutorial on how to install git on Linux (CentOS & RHEL). Please do send in any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Simple way to install Git on CentOS/RHEL appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/simple-way-to-install-git-on-centos-rhel/feed/ 2 1109
Install Git on Ubuntu – The Easy Way https://thelinuxgurus.com/install-git-on-ubuntu-the-easy-way/ https://thelinuxgurus.com/install-git-on-ubuntu-the-easy-way/#respond Thu, 06 Feb 2020 08:12:02 +0000 https://thelinuxgurus.com/?p=1106 Git is one an open-source & distributed version controlling system, that is used for tracking changes in files/code among multiple peoples/locations. It is the most...

The post Install Git on Ubuntu – The Easy Way appeared first on The Linux GURUS.

]]>
Git is one an open-source & distributed version controlling system, that is used for tracking changes in files/code among multiple peoples/locations. It is the most used version controlling system that is being used by millions of users & almost all the organizations use it.

It is a distributed system that allows every repository on every system to act as a full-fledged repository itself with complete history & version tracking capabilities.

Recommended Read: Ultimate guide to install PYTHON from source

Also Read: Complete guide to install Anaconda on Ubuntu

It was created by Linus Torvalds for Linux kernel development. It is free software & distributed under the terms of GNU General Public License. In this tutorial, we will learn to install git on Ubuntu systems. So this tutorial should work for all Ubuntu versions. Here we will be discussing two methods to install git on Ubuntu, i.e.,

1- Using default package manager

2- Using source packages


Install Git on Ubuntu

1- Using default package manager

Git packages are maintained on the default package repositories for Ubuntu. They might not be the latest packages but they will be stable packages. So to install git on Ubuntu using apt, we can use the following command,

$ sudo apt-get update

$ sudo apt-get install git

This would install git on Ubuntu. If for some reason, you need the latest or any particular version of the git, then we recommend that you use the second method for git installation.


2- Using source packages

Before we proceed with git installation using the source packages, we must have all the required packages for the compilation of git source package. Install the required packages using the following command,

$ sudo apt-get update

$ sudo apt-get install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

Now we can either download a particular version or can also install the latest git version, for this tutorial i will be installing the latest packages. So first, we will download the latest packages,

$ wget https://github.com/git/git/archive/master.zip

The latest packages will always be available at the mentioned url. Next, we need to unzip the downloaded package,

$ unzip master.zip

$ cd master

Now compile & install git on Ubuntu with the following command,

$ make prefix=/usr/local all

$ sudo make prefix=/usr/local install

This will install git on your system. In order to use the Git, you can refer to git commands cheat sheet here. So this concludes our tutorial on how to install git on Ubuntu. Please do send in any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Install Git on Ubuntu – The Easy Way appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/install-git-on-ubuntu-the-easy-way/feed/ 0 1106
Complete guide on Git Commands for Beginners https://thelinuxgurus.com/complete-guide-on-git-commands-for-beginners/ https://thelinuxgurus.com/complete-guide-on-git-commands-for-beginners/#comments Thu, 06 Feb 2020 07:56:24 +0000 https://thelinuxgurus.com/?p=1099 We have already discussed how to install Git on Ubuntu & on CentOS/RHEL. We should aware of how to use git to complete our intended...

The post Complete guide on Git Commands for Beginners appeared first on The Linux GURUS.

]]>
We have already discussed how to install Git on Ubuntu & on CentOS/RHEL. We should aware of how to use git to complete our intended function. In this tutorial, we will discuss the git commands that you should be aware to use git.

Recommended Read: Conda Commands cheat sheet for Beginners

Also Read: Complete guide to install PyCharm on Ubuntu

GIT Commands for Beginners


Setting user information (git config)

This should be your step after you have installed git on your system. We need to add user information (user name & email), for tracking purposes of git. To add information about the user, the command is ‘git config’

$ git config –global user.name “Prince”
$ git config –global user.email “prince@thelinuxgurus.com”

To check the entered information, use

$ git config –list

Now let’s discuss other git commands.


Create a new repository (git init)

To create a new repository, the command is

$ git init


Search a repository (git grep)

To search a repository, the command is

$ git grep “repository”


Connect to a remote repository (git remote)

To connect to a remote repository, the command is

$ git remote add origin remote_server

Then to check all the configured remote server,

$ git remote -v


Clone a repository (git clone)

To clone a repository from a local server, run the following commands

$ git clone repository_path

If we want to clone a repository located at a remote server, the command would be

$ git clone username@server:/repository_path


List Branches in the repository (git branch)

To check the list of all available & the current working branch, execute

$ git branch


Create a new branch (git checkout)

To create & use a new branch, the command is

$ git checkout -b ‘branch-name’


Deleting a branch (git branch)

To delete a branch, execute

$ git branch -d ‘branch-name’

If required to delete a branch on a remote repository, execute

$ git push origin:’branch-name’


Switch to another branch (git checkout)

To switch to another branch from the current branch, use

$ git checkout ‘branch-name’


Adding files to commit (git add)

To add a file to the repo, run

$ git add filename


Status of files (git status)

To check the status of files i.e. files that are to be committed or that are to be added, run

$ git status


Commit the changes (git commit)

After we have added a file or made changes to one, we will commit the code by running,

$ git commit -a

To commit changes to head and not to the remote repository, the command is

$ git commit -m “message”


Push changes (git push)

To push changes made to the master branch of the repository, run

$ git push origin master


Push the branch to the repository (git push)

To push the changes made on a single branch to the remote repository, run

$ git push origin ‘branch-name’

To push all branches to the remote repository, run

$ git push –all origin


Merge two branches (git merge)

To merge another branch into the current active branch, use

$ git merge ‘branch-name’


Merge from remote to the local server (git pull)

To download/pull changes to the working directory on local server from the remote server, run

$ git pull


Checking merge conflicts (git diff)

To view merge conflicts against the base file, run

$ git diff –base ‘filename’

To see all the conflicts, run

$ git diff

If we want to preview all the changes before merging, execute

$ git diff ‘source-branch’ ‘target-branch’


Creating tags (git tag)

To create tags to mark any significant changes, run

$ git tag ‘tag number’ ‘commit id’

We can find commit id by running,

$ git log


Push tags (git push)

To push all the created tags to the remote server, run

$ git push –tags origin


Revert changes made

If we want to replace changes made on the current working tree with the last changes in the head, run

$ git checkout –‘filename’

We can also fetch the latest history from remote server & point it local repository’s master branch, rather than dropping all local changes made. To do this, run

$ git fetch origin

$ git reset –hard master

These were some of the git commands that are used regularly & should be able to get you started with using git. That’s all we have for this tutorial, please do send in any questions, queries or suggestions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Complete guide on Git Commands for Beginners appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/complete-guide-on-git-commands-for-beginners/feed/ 1 1099