Push code via SSH keys

I was facing problem i.e I was unable to push code on GitHub from home network. Whenever I tried to push or clone code, it  was giving below error:

error: RPC failed; result=7, HTTP code = 0
fatal: The remote end hung up unexpectedly

This problem was coming with https protocol. Then I tried to solve problem with another method. I used SSH to fix above error.

How I solved  above error?

I used SSH keys instead of https. In this method, you will generate your public key and attach that key with  your GitHub account.

Step1: Install OpenSSH:

sudo apt install openssh-server

Step 2: clone repository with ssh:

screenshot-from-2016-09-19-224033

But it will give below error because you did not generate and connect public key.

screenshot-from-2016-09-19-224817

Step 3: Generating public/private rsa key pair:

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Step 4: List the files and directories in your ssh folder:

$ ls -al ~/.ssh

Step 5: Check that you are connecting to the correct server:

To make sure you are connecting to the right domain, you can enter the following command:

screenshot-from-2016-09-19-231205

Note the IP address (the numbers within the [] brackets). The connection should be made to a GitHub IP address, on port 22.

Step 6: Add your SSH  key to the ssh-agent:

$ ssh-add

Step 7: Verify that you have a private key generated and loaded into SSH. If you’re using OpenSSH 6.7 or older:

$ eval "$(ssh-agent -s)"
$ ssh-add -l

Step 8: Add your SSH key to your account:

$ sudo apt-get install xclip 
$ xclip -sel clip < ~/.ssh/id_rsa.pub

Then add the copied key to GitHub. Go to Settings->SSH keys(Personal settings side bar)->Add SSH key->fill out form(key is on your clipboard, just use ctrl+v)->Add key.

Done 🙂

Now you can clone and push code via SSH keys :-). See

screenshot-from-2016-09-19-234927

Enjoy 🙂

 

Advertisements

Hackathon

Today, We did Hackathon. It was Hackathon for Ebook project. In  our team, there were 6  members. Sir,  discuss with us requirements of   a project and  its present error from user  point  of view. Then  we begin  Hackathon. Firstly, one member created the repository  on Gitlab    and for  scheduling  of  task, we  use Trello. As first task, we reorganized the chapters, we just remove hard code  using JSON and  shell script. Secondly, we make Ebook screen compatible, add  minor  code to differentiate with mobile screen and Desktop. Third was to make its browser compatible (pending). The fourth was to resolve an issue of div overlapping. Which is in progress. We enjoyed Hackathon :-).

July 15, 2016 (Makefile)

Today, Amrit gave a presentation on Make. It was a very good presentation. Anyone can make makefile who listened to his presentation.

Before start, he presents difference between script and make. When  the script is used, all files are compiled during compilation, even only single file is changed. But when we make makefile, it will compile only that s changed. And make is beneficial only if there is a large project.

After that he shows us demo of a makefile. Basically, to create makefile We must know the steps of compilation to get final result. We must know commands that will be used to get the final output. Then follow same steps in a makefile.  But must create object file that is needed to  get  final output.  And there is one option “-I “, when this option used compiler search current directory to get header file (.h file created by us). If this optoin “I” is not used then the compiler will search standard library to get your header file. And .PHONY is most important in  a makefile. Using it, compiler recognised that there are commands under the variable assigned to .PHONY. For example: If I define .PHONY=CLEAN and write some bash commands under CLEAN then compiler will run that commands. Without assigning CLEAN to .PHONY, a compiler will consider CLEAN as a file.

ngrok in Linux

Today, I install and use ngrok. ngrok is similar to Teamviewer which is used in windows and Linux to connect computers from any remote location and does not require to be on the same network. I thought that ssh can access computer only on the same network. So, I used Teamviewer instead of ssh.

Later on, Amrit told me about ngrok and he said that we can connect computers  from any remote location using ngrok.  So, I  install it 🙂

ngrok is easy to use. Follow below steps:

  • Just  download its zip file from : https://ngrok.com/download.
  • Then unzip it. It will  create binary file  ngrok. Then run this binary file using ./ngrok.
  • Now login on : https://ngrok.com/download and Install your authtoken using :
    ./ngrok authtoken 2CAB7**************************
  • Now read its README file and apply command for your purpose.
  • for example: ./ngrok tcp 22 (if you want to provide  your computer as server on terminal). just give its link to client computer.
  • ./ngrok http 80  (if someone wants to access your computer from a browser).

JSON with LaTeX

Today, I used JSON data in LaTeX. To do this, Firstly, I load one file JSON.lua  in .tex file. When I did not download and load JSON.lua file in tex, it  was giving an error during compilation.  And when we are using JSON data inside .tex file then we use lualatex command to run latex code instead of pdflatex. 

Create Bootable Pendrive of window 7 in Ubuntu

Yesterday, I created bootable USB of window 7. Normally, we use Startup Disk Creator to make bootable Pendrive from Linux-iso in Ubuntu. But we can’t make bootable Pendrive of the window using startup disk creator in ubuntu. So, we need another software to do this. Yesterday, Amrit suggested me to use winusb  for this purpose. I wanted to search But he told me, My Bad Luck 😛 . Then I install winusb in ubuntu and make bootable Pendrive from window-iso.