Git Add user to local repository

user@Sys208:~/works/Project1/data-entry/Data-entry-tool$ git add -A && git commit -m “Initial Commit.”

*** Please tell me who you are.


git config –global “”
git config –global “Your Name”

to set your account’s default identity.
Omit –global to set the identity only in this repository.

fatal: unable to auto-detect email address (got ‘user@Sys208.(none)’)

To set the user local to the repository navigate to the working directory and open a terminal and issue the following commands

user@Sys208:~/works/Project1/data-entry/Data-entry-tool$ git config “”
user@Sys208:~/works/Project1/data-entry/Data-entry-tool$ git config



Samples on Play

Chat Application

Reactive, real-time log search with Play, Akka, AngularJS and Elasticsearch

Forums built with Play

Improving Play! 2.1 with Knockout.js


Optimizing Static Asset Loading with Play Framework



Neat Explanation of using JPA with Play:-

application.conf example :-–Framework-Example–Library/master/conf/application.conf



Action composition in the Play Framework


Building a REST API in Java and Scala Using Play Framework – Part 1


Dependency injection in Play Framework using Scala


Introducing the Google Guava Cache




Hibernate with JPA Annotations and Guice


Best of Breed Opensource on Play

File Cutters, File Spiltting playframework samples

grpc play framework:

Setting up PHP Environment for Development


Real time scenarios on GIT

git clone
git add -all : add all files new and modified locally

git add -A && git commit -m “Comment formatting, 24 hour cache loader, api/contact.”
add all files new and modified locally, commit them locally.

How to see what has changed before actually doing commit

# show differences between index and working tree
# that is, changes you haven't staged to commit
git diff [filename]
# show differences between current commit and index
# that is, what you're about to commit
git diff --cached [filename]
# show differences between current commit and working tree
git diff HEAD [filename]


git status
git diff
git status
git pull
git stash
git pull
git stash list
git apply stash@{0}
git stash list
git stash apply stash@{0}
git push -u origin master
git status
git push -u origin master
cd /home/user/projects/******-server
git status
get status
git status
git log
git push -u origin master
git push -u origin master git_tracing=2
git push -u origin master


git status
git add –all
git status
git add -all -v
git add –all -v
git add -i
git status
git stash list
git add -A && git commit -m “Comment formatting, 24 hour cache loader, api/contact.”
git add -A && git commit -m “Resolved Conflicts in conf/routes”
git push -u origin master
git status
git status remote
git status remote origin
git remote show origin
cd /home/user/projects/******-server
git remote show origin

git pull

remote: Counting objects: 8, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
ecc5a5f..32ce420  master     -> origin/master
Auto-merging conf/routes
CONFLICT (content): Merge conflict in conf/routes
Automatic merge failed; fix conflicts and then commit the result.

git status

In case of CONFLICTS resolve conflicts, first, then do a push.

To resolve conflicts, first determine the files under conflict, by issuing git status or

git log –merge -p conf/routes

Resolve your conflicts in any editor or iDEA

git add -A && git commit -m “Resolved Conflicts in conf/routes” : Perform a local commit

git push -u origin master

git config merge.conflictstyle diff3
git status
git diff
git status
git diff
git status
git diff app/controllers/users/
git diff HEAD app/controllers/users/
git status

git add -A && git commit -m “Comment formatting, 24 hour cache loader, api/contact.”

before doing a push check always ensure to do a pull



git pull
676  git stash –help
677  git log
678  git stash list
679  git stash save “Tests included for BadRequest, Exception Handling in fetchstatesforcountries”
680  git show
681  clear
682  git stash list

user@sys204:~/projects/datacaptive-server$ git stash list
stash@{0}: On master: Tests included for BadRequest, Exception Handling in fetchstatesforcountries
stash@{1}: WIP on master: 8829572 API Contracts, to return JSON responses. sabhi
683  git pull
684  git apply stash@{0}
685  git stash apply stash@{0}


Determine your remote repository

user@user-HP-Compaq-8100-Elite-SFF-PC:~/projects/*****-server-1$ git config --get remote.origin.url***********ivedevs/*****-server.git

git remote show origin


In certain cases you need to checkout a branch from a remote

git clone –branch 130707-kibana-demo



git log –graph –oneline –decorate –all

In case of comparing what your local has and what has been done on remote, it is first required to fetch the references of your remote on to your local

user@sys204:~/projects/******-server$ git fetch
Username for ‘’: ******@******.com
Password for ‘https://******@******.@*****.com’:
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
7950246..666039a  master     -> origin/master


After doing a fetch, issuing a log would still result in local changes and not depicting remote changes.

user@sys204:~/projects/******-server$ git log

user@sys204:~/projects/******-server$ git log -all : displays the fetch references and the local refs

user@sys204:~/projects/******-server$ git log origin/master : displays the fetch references and the local refs





At times there might be ignored files which would have been indexed and committed to the repo, and later realized that the files should not have been there.

Your .gitignore is working, but it still tracks the files because they were already in the index.

To stop this you have to do : git rm -r --cached .idea/

When you commit the .idea/ directory will be removed from your git repository and the following commits will ignore the .idea/ directory.

PS: You could use .idea/ instead of .idea/* to ignore a directory. You can find more info about the patterns on the .gitignore man page.



Roll back a git pull over a local repo:

git pull is a composition of git fetch and git merge. While fetch does retrieve only the refs, the merge is where the local repo files are merged with remote file. To undo a pull we could only git merge –abort, this command would undo the merge operation after the pull.

Rollback/Undo a commit

Undoing a commit is a little scary if you don’t know how it works. But it’s actually amazingly easy if you do understand.

Say you have this, where C is your HEAD and (F) is the state of your files.


You want to nuke commit C and never see it again. You do this:

git reset --hard HEAD~1

The result is:


Now B is the HEAD. Because you used --hard, your files are reset to their state at commit B.

Ah, but suppose commit C wasn’t a disaster, but just a bit off. You want to undo the commit but keep your changes for a bit of editing before you do a better commit. Starting again from here, with C as your HEAD:


You can do this, leaving off the --hard:

git reset HEAD~1

In this case the result is:


In both cases, HEAD is just a pointer to the latest commit. When you do a git reset HEAD~1, you tell Git to move the HEAD pointer back one commit. But (unless you use --hard) you leave your files as they were. So now git status shows the changes you had checked into C. You haven’t lost a thing!

For the lightest touch, you can even undo your commit but leave your files and your index:

git reset --soft HEAD~1

This not only leaves your files alone, it even leaves your index alone. When you do git status, you’ll see that the same files are in the index as before. In fact, right after this command, you could do git commit and you’d be redoing the same commit you just had.

One more thing: Suppose you destroy a commit as in the first example, but then discover you needed it after all? Tough luck, right?

Nope, there’s still a way to get it back. Type git reflog and you’ll see a list of (partial) commit shas that you’ve moved around in. Find the commit you destroyed, and do this:

git checkout -b someNewBranchName shaYouDestroyed

You’ve now resurrected that commit. Commits don’t actually get destroyed in Git for some 90 days, so you can usually go back and rescue one you didn’t mean to get rid of.


Ubuntu not showing eclipse menu

  1. Open your eclipse.desktop file:
    sudo -H gedit /usr/share/applications/eclipse.desktop

    (If you can’t find it in this path, try in ~/.local/share/applications/eclipse.desktop. Otherwise, you could have to find yours using locate command).

  2. Replace the Exec= line with this:
    Exec=env UBUNTU_MENUPROXY= eclipse

    Where “eclipse” is the path to your eclipse executable. In this case it’s just “eclipse” since there’s a symlink in /usr/bin folder.

    NOTE: If you can’t find your eclipse.desktop file, you can simply create one from scratch in the above path, and fill it with these lines:

    [Desktop Entry] 
    Exec=env UBUNTU_MENUPROXY= eclipse 
  3. Save the file.

MySQL Restore Dump Files to Empty DB

A quicker and faster way to restore databases.

Ensure to have a blank database before we run the restore script.

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u root -p epaygit20161208 < restore.sql
Enter password: ********

And your done like….



By default MySQL in the .cnf file specifies some system wider variables. To view the system variables in the query browser execute

show variables;

MySQL by default has 150 connections, can be looked up by the command,
show variables like ‘max_connections’;

To increase the maximum number of connections, set the global variables

SET GLOBAL max_connections = 500; i


How to Backup a MySQL Database with mysqldump

One of the most common ways of backing up with MySQL is to use a command called “mysqldump“.

Backing Up

There is an article on how to export databases using mysqldump here. The basic syntax of the command is:

mysqldump -u username -p database_to_backup > backup_name.sql

At times when restoring databases from local system to AWS/RDS there can be
broken pipes, where in the connection of the SSH tunnel is lost and there restoration
fails. To avoid this we can increase the time out of the SSH

If you want to have a longer connection period, in the client add:

echo 'ServerAliveInterval 30' | sudo tee -a ~/.ssh/config
echo 'ServerAliveCountMax 1200' | sudo tee -a ~/.ssh/config

ServerAliveCountMax by default this is set to 3. Therefore once the ServerAliveInterval has sent 3 small packs of info to your server it will then automatically log out. Setting it to 1200 means this process will have to occur at least 1200 times. In short you should be connected at least 30*1200 seconds (10 hours).

Setting up Play Development Environment on Ubuntu

# Configure apt for java
apt-get update
apt-get install -y python-software-properties
add-apt-repository -y ppa:webupd8team/java
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections

# Update apt sources
apt-get update

apt-get install -y unzip wget git vim oracle-java8-installer oracle-java8-set-default

# Install scala
cd /opt
tar -zxvf scala-2.12.0.tgz
# end scala

#Installing playframework on ubuntu there are two options

Go to, download the offline installer close to 617MB


# Install play with activator
#Download and Install Play (the folder should have permission to write)
#mv activator-1.3.12-minimal activator

The off-line installer downloads all the dependencies required to run play applications. In a scenario where in we download only the small foot print of activator the dependencies are downloaded at the time of loading the project, which can be annoying and time consuming.

Follow the instructions at to install the play and chose “installing play with activator” and follow instructions listed
Extracting Activator

Extract the archive on a location where you have write access. Running activator writes some files to directories within the distribution, so don’t install to /opt, /usr/local or anywhere else you’d need special permission to write to.
Adding Activator to your Path

For convenience, you should add the Activator installation directory to your system PATH:

export PATH=$PATH:/opt/activator/bin

source ~/.bashrc

Making the activator as an executable execute the following command

sudo chmod a+x /activator/bin/activator

Just in case after executing the above commands and when we issue activator in the terminal, if it says command not found, we need to manually edit the bashrc file as follows

gedit source ~/.bashrc

add the command to the bottom of the file

export PATH=$PATH:/opt/activator/bin


mv typesafe-activator-1.3.12 activator

cd /opt
export PATH=$PATH:/opt/activator/bin
source ~/.bashrc
sudo chmod a+x /activator/bin/activator
# end play with activator

#echo ‘PATH=${PATH}:/opt/scala-2.12.0/bin:/opt/play-2.2.5’ >> /etc/profile
echo ‘PATH=${PATH}:/opt/scala-2.12.0/bin’ >> /etc/profile

echo ‘PATH=${PATH}:/opt/activator/bin’ >> /etc/profile

sudo apt-get install git

echo “Installing IntelliJ IDEA…”

# We need root to install
[ $(id -u) != “0” ] && exec sudo “$0” “$@”

# Attempt to install a JDK
# apt-get install openjdk-8-jdk
# add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install oracle-java8-installer

# Prompt for edition
#while true; do
#    read -p “Enter ‘U’ for Ultimate or ‘C’ for Community: ” ed
#    case $ed in
#        [Uu]* ) ed=U; break;;
#        [Cc]* ) ed=C; break;;
#    esac

# Fetch the most recent version
VERSION=$(wget “” -qO- | grep -P -o -m 1 “(?<=[^/]+(?=/)”)

# Prepend base URL for download

echo $URL

# Truncate filename
FILE=$(basename ${URL})

# Set download directory

echo “Downloading idea-I$ed-$VERSION to $DEST…”

# Download binary
wget -cO ${DEST} ${URL} –read-timeout=5 –tries=0

echo “Download complete!”

# Set directory name

echo “Installing to $DIR”

# Untar file
if mkdir ${DIR}; then
tar -xzf ${DEST} -C ${DIR} –strip-components=1

# Grab executable folder

# Add permissions to install directory
chmod -R +rwx ${DIR}

# Set desktop shortcut path

# Add desktop shortcut
echo “[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application” -e > ${DESK}

# Create symlink entry
ln -s ${BIN}/ /usr/local/bin/idea

echo “Done….Installing IntelliJ IDEA…”

echo “Start….Installing Scala..”

How to Install MySQL – Ubuntu


apt-get install --print-uris mysql-server > desktop

This will print out a bunch of URLs. You can download these from another computer, and transfer them to your Ubuntu machine, putting the .deb files into /var/cache/apt/archives.

sudo apt-get install mysql-server

And apt will find the package files you’ve downloaded, and install mysql.

Installing SBT on Ubuntu

Sbt is the default build tool for Scala. This post talks about steps to install sbt on ubuntu.

Steps to Install SBT on Ubuntu

#Add typesafe repository     
wget `

#Install the repository
sudo dpkg -i repo-deb-build-0002.deb

sudo apt-get update

#Install sbt
sudo apt-get install sbt

#check whether sbt is installed


Add Specific Version of SBT

Some project need specific version of sbt like 0.13.

If you get error saying

Detected sbt version 0.12.2 Cannot find sbt launcher 0.12.2 Please download: From… To /home/{username}/.sbt/.lib/0.12.2/sbt-launch.jar

Run the following commands by replacing with your username.

mkdir -p /home/{username}/.sbt/.lib/0.12.2/ 
 wget -O /home/{username}/.sbt/.lib/0.12.2/sbt-launch.jar