Installing git on server
Ref :: https://www.rosehosting.com/blog/how-to-install-configure-and-use-git-on-an-ubuntu-14-04-lts-vps/
UPDATE THE SYSTEM
Before installing and setting up GIT, make sure your Ubuntu Linux VPS is fully up to date by using the following commands:
## apt-get update
## apt-get upgrade
INSTALL GIT USING APT
The best and fastest way to install GIT on your Ubuntu 14.04 VPS, is to use apt as in:
## apt-get install git-core
GIT CONFIGURATION
Once GIT is installed on your linux server, you may want to configure it using git config or its configuration file .gitconfig, though it is not required as GIT will work with no-configuration by default. Anyway, let’s set-up some GIT parameters using git config:
Set-up Name/Email
## git config --global user.name "My Name"
## git config --global user.email myname@example.com
Set-up Editor
## git config --global core.editor vim
Set-up Diff tool
## git config --global merge.tool vimdiff
Display GIT Configuration
## git config --list
to learn more about git config, refer to its man page.
CREATE GIT REPOSITORY
You can easily create a GIT repository on your linux virtual server using something like this:
## mkdir -p /repos/my-git-project
## cd /repos/my-git-project
## git init --bare
WORK WITH GIT REPOSITORY
Now, clone the repository you just created, add a sample README file, commit your changes and perform a push request using:
## cd /home
## git clone ssh://root@myserver.com/repos/my-git-project
## cd my-git-project
## echo test > README
## git add README
## git commit -m "Initial commit. Adding README file"
## git push origin master
COMMON GIT COMMANDS
Git status
changed files in your working repository
## git status
Git log
show all git commits
## git log
Git diff
made changes to tracked files
## git diff
Git branch
list all branches
## git branch