SQL Joins

Image
Joins are used to combine rows from two or more tables based on related columns between them. Joins allow you to retrieve data from multiple tables simultaneously, enabling you to create complex queries that fetch data from different sources. There are different types of joins in SQL, including: INNER JOIN Returns only the rows that have matching values in both tables based on the specified join condition. It discards non-matching rows from both tables. Example:           create table t1(x int); insert into t1 values(1); insert into t1 values(1); insert into t1 values(0); create table t2(y int); insert into t2 values(0); insert into t2 values(1); insert into t2 values(1);           select * from t1 inner join t2 on t1.x = t2.y Output: 2. LEFT JOIN (or) LEFT OUTER JOIN Returns all the rows from the left (or first) table and the matching rows from the right (or second) table. If there is no match, NULL values are

Permission denied while connecting Amazon EC2 with GITLAB through SSH


ubuntu@ip:~/folder$ git clone git@gitlab.com:name/repo.git
Cloning into 'folder'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


You are getting this error because EC2 instance have dosen't enough permission to access this git repo.
You can solve this issue by adding the EC2 instance ssh key to gitlab.

The following are the step to generate ssh in EC2 and add that to gitlab,


ubuntu@ip-:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/ubuntu/.ssh/id_rsa.
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/f+sdfsdfasdfxHdfa7uliBQviGGidshezsLI ubuntu@ip
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
| .. .            |
|.+.=. . ..  . ..=|
|. =++. .So.. o.=*|
|.o.o.   . +.. .oo|
|...      o +oooo.|
|E       o o.+*+.*|
|       . ++...o=o|
+----[SHA256]-----+


The above command will generate the ssh key , and by default it place the key in .ssh folder.
You can copy this by 

ubuntu@ip-:~$cat ~/.ssh/id_rsa.pub
ssh-rsa Agsdfc2EAdfasdfasdXTFTBYDN+BeNsvuWcwThzDpGAvh1efdHOeJ4nq49RSPYfasdfxtASS0skEcuAu8YyglTcnoYuWxZtql4pUJBSib+x6rP6bxz4/oyuv7lz7Dw4XMyyVKlTEi/F/FewMsS4xd6zPnWfghhPQ+fXneV1AF6/IxD+d9I92fsdfasdfxipKpFTM+peyGTAqg5H73ebKvup13g/YUvUcIvc90zaF/UCHFS4xWA8ekuwTpnKHq1Yq+wiPKIq2V+/16Fi3B5VXOnWOx6s3hmasdfasdfOJ27RJ3lQKETSrE7cv+nqedOt ubuntu@ip-


Go to gitlab --> setting --> SSH Key  ,then paste the above ssh key into the key control like this 




Now try again , it will work

Comments

Popular posts from this blog

Machine Learning Foundations - Deep Learning Summary - Quiz

Machine Learning Foundation - Deep Learning - Programming Assignment

Machine Learning Foundations - Recommender System - Quiz