Pushing and pulling code without entering credentials

Useful link

In order to push and pull without entering credentials:

1. Get and copy the contents of your key:

cat ~/.ssh/id_rsa.pub

2. Add that key to github (if it doesnt already exist). This can be done here https://github.com/settings/keys.

3. Ensure that your project (locally) is set to the correct remote repository URL.

Reconfigure existing repositories to use SSH

The repositories we clone from now on using SSH will continue to use SSH for future Git commands such as `git pull` and `git push`. But existing local repositories, previously cloned with HTTPS, will continue to use HTTPS, unless we set them up to use SSH.

To do that, open the terminal and change the current directory to a local repository.

List the existing remote repositories and their URLs with:

git remote -v

That command should output something like:

origin  https://your_server/your_user_name/your_project_name.git (fetch)
origin  https://your_server/your_user_name/your_project_name.git (push)

Change your remote repository’s URL with:

git remote set-url origin git@your_server:your_user_name/your_project_name.git
#ie: git remote set-url origin git@github.com:MiroslavGlamuzina/REPO_NAME.git

Run `git remote -v` once more to verify that the remote repository’s URL has changed:

origin  git@your_server:your_user_name/your_project_name.git (fetch)
origin  git@your_server:your_user_name/your_project_name.git (push)