GitHub is highly secure and respects ssh-rsa. Therefore, we need to configure ssh as the public key for our connection, and let github know about it.
take the terminal and as a user (not root, usually many of us have the habit of typing sudo su as the first command on the terminal, this time avoiding it) Type
ssh-keygen -t rsa -C " yourmailid@gmail.com "
Here -t → indicates which encryption -C → try to use the same mail id that you specified for ti github (for convenience of memory)
now you will get two id_rsa and id_rsa.pub files in ~ / .ssh /
now copy all the content to the id_rsa.pub file without changing the contents of the file.
Now go back to your github account. go to account settings →> SSH Public Keys Add a new key and paste the contents that you copied into the "key" field and save (specify the name of your choice).
github now knows how to handle requests from your system.
try
$ssh git@github.com
thuis must return hello! UserName is ignored if any error is shown, but make sure it shows Hello! Username
well! now we are going to install a local copy of the repositories on the ouor machine and reflect the changes in the remote system.
create a directory (as user, not root)
mkdir MyProject cd MyProject git init
(initialize an empty git repository, see the hidden .git / there folder.) after creating the files in MyProjects, when you want to add it to your repository in github, do
git add
now run the status and check the files that you are going to commit next,
git status git commit -m "Your comment about this commit"
(this updates the .git / folder in your local repository) now we will tell git about the updated remote repository
git remote add origin git@github.com :username/ProjectName
(do you remember where we got this url, its cloning url)
git push origin master
Hope this works for you.