Monday, August 19, 2019

How do you handle git merge conflicts? - Git Merge conflicts

Git Merge conflicts

Merging and conflicts are a common part of the Git experience. Conflicts in other version control tools like SVN can be costly and time-consuming. Git makes merging super easy. Most of the time, Git will figure out how to automatically integrate new changes.

Why conflicts happen?

Conflicts generally arise when two people have changed the same lines in a file, or if one developer deleted a file while another developer was modifying it. In these cases, Git cannot automatically determine what is correct. Conflicts only affect the developer conducting the merge, the rest of the team is unaware of the conflict. Git will mark the file as being conflicted and halt the merging process. It is then the developer's responsibility to resolve the conflict.


How will you establish connection securely between two systems without password, but secured way?

How will you establish connection securely between two systems without password, but secured way?
1. Create keys using ssh-keygen command in source machine. This will create private and public keys.
2. upload the public keys into target machine
3. then do ssh into target_node_ip.
once public keys uploaded, client can talk to server securely without password.




Wednesday, August 14, 2019

How to test SSH connection keys added in Bitbucket or GitHub?

How to test SSH connection keys added in Bitbucket or GitHub?

BitBucket
ssh -T git@bitbucket.org
logged in as <user_name>

You can use git or hg to connect to Bitbucket. Shell access is disabled

GitHub
ssh -T git@github.com
Hi <user-name>! You've successfully authenticated, but GitHub does not provide shell access.



Monday, August 12, 2019

What is Git? What is difference between Git and GitHub or Bitbucket?

Git is a open source version control system, also known as SCM(source code management system) tool. It was founded by Linux Torvalds (founder of Linux OS).

Git is different from traditional version control systems such as SVN, CVS, etc. Git is distributed in nature which allows developers to have full history of their code repositories locally.

Git also has other features - branching, merging, pull requests, re-writing commit history.

Git is the most widely used version control system in the world today and is considered the modern standard for software development.

 BitBucket and GitHub are git based repositories hosted on internet or it could be hosted on-prem as well.

You need to have git client installed on your machine in order to access GitHub or BitBucket Repo.

To learn more about the difference between Git and other source version control systems, please click here.

Wednesday, August 7, 2019

How to copy SSH keys from one machine to other machine - How to transfer SSH keys into target server

Let's say you have two servers - Host_A & Host_B, you would like to copy SSH keys from A to B. You need to generate keys and use ssh-copy-id command to transfer keys from source machine to target machine.

1. Generate Keys

ssh-keygen

use the above command to generate SSH keys on source machine.

Enable Password Authentication

Open sshd_config file

sudo vi /etc/ssh/sshd_config






Enable password authentication by changing to yes

Restart ssh service

sudo service sshd restart

2. ssh-copy-id

ssh-copy-id Host_B

say yes and enter


After this, make suue you are able to ssh into Host_B

ssh Host_B


Monday, August 5, 2019

Setup Tomcat8 on Red Hat Enterprise Linux 8 - How to install Tomcat 8 on Red Hat 8

Welcome to setting up Tomcat 8 on RedHat Linux 8.

Please find below steps for setting up Tomcat 8 on RHEL 8.

update package

sudo yum update

Install wget
sudo yum install wget -y
sudo yum install unzip -y

Java Installation

Download Java from Oracle site.

sudo wget --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' 'http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm'

Install from RPM
sudo  rpm -i jdk-8u141-linux-x64.rpm

java -version

make sure Java version appearing fine.

Tomcat Installation

cd /opt

sudo wget http://apache.osuosl.org/tomcat/tomcat-8/v8.5.43/bin/apache-tomcat-8.5.43.zip

unzip Tomcat

sudo unzip apache-tomcat-8.5.43.zip

create a symbolic link 
sudo ln -s /opt/apache-tomcat-8.5.43 /opt/tomcat

Create user for tomcat

Create a user for running tomcat and give required permissions.
sudo useradd tomcat
sudo chown -R tomcat:tomcat /opt/apache-tomcat-8.5.43
sudo chmod +x /opt/tomcat/bin/*.sh

Create tomcat 8 as a service

sudo vi /etc/systemd/system/tomcat.service

[Unit]
Description=Tomcat
After=syslog.target network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

ExecStart=/opt/tomcat/bin/catalina.sh start
ExecStop=/opt/tomcat/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

Re-load systemd

sudo systemctl daemon-reload

Restart Tomcat8 as a service

sudo systemctl start tomcat

Verify Tomcat service is running
sudo systemctl status tomcat

Enable as a service

sudo systemctl enable tomcat