InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Git tutorials

  • Github for beginners
  • Undo last commit
  • List git branches
  • Git checkout remote branch
  • Diff two branches
  • Show log of one user's commits
  • View diff for a given commit id
  • Setup password less git push for github
  • Git - Check if a hash is valid
  • Git - display specific length commit hash
  • Git - rename local branch
  • Git create branch
  • Git delete branch
  • Git detached head
  • Git display info of last commit (HEAD) in one line
  • Git display local HEAD location
  • Git log with file names
  • Git show details of a commit hash
 
  • Home
  • > Tutorials
  • > Git

How to setup password less git push for github

By admin on Dec 16, 2015

You can use user and password based authentication to push git changes to GitHub. But it is cumbersome to type user and password with every push. A better alternative is to use ssh key for authentication while pushing. Here are steps to setup ssh key based password less authentication with GitHub.

Create a ssh public and private keys

First create a public/private key for authentication. You can create ssh key pair (without passphrase) as mentioned in the linked tutorial. You can use the following location for two generated files.

  1. ~/.ssh/id_rsa.github
  2. ~/.ssh/id_rsa.github.pub

Add public keys to GitHub

  1. Goto GitHub settings page:
    github-setting-menu-item
  2. Add you public keys to GitHub by copying content from ~/.ssh/id_rda.github.pub
    github-ssh-add-key-interface
  3. Once you add your public key, you should see it in the list of keys in your account.
    github-account-ssh-keys-list

GitHub config on you local machine

  1. First setup remote.origin.url using
    $ git config  remote.origin.url git+ssh://git@github.com/youriserid/repoid.git
    

    Old : https://github.com/youriserid/repoid.git
    New: git+ssh://git@github.com/youriserid/repoid.git

  2. To see all git config values and validate if remote.origin.url has been set

    $ git config -l
    
  3. Now add the following lines to you ~/.ssh/config to ssh that for github servers we want to use git key

    Host github.com
    IdentityFile ~/.ssh/id_rsa.github
    

    Test that you can ssh to github

    $ ssh -T git@github.com
    Hi user1! You've successfully authenticated, but GitHub does not provide shell access.
    
  4. Now make any test change and commit locally. To push to origin run the following and it should not ask for password.

    $ git push origin master
    

Suggested posts:

  1. Github tutorial for beginners
  2. Linux – how to enable password login on ssh server
  3. Git – checkout remote branch
  4. Ssh automation on Amazon EC2 Ubuntu Linux
  5. How to use qpdf to add/remove password from pdf on mac
  6. Display keys added to ssh-agent using ssh-add
  7. How to check if a user has password on Linux
  8. How to zip/unzip a directory with password
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Devops, Git, Github, Linux, Mac, SSH, Tutorials

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2022 InfoHeap.

Powered by WordPress