Search code examples
gitgithubssh.netrc

Ssh key on github


Whenever I want to commit something on my repository, I have to type

ssh-add ~/.ssh/my_git_key_file

Is there a way to not do that every time I want to commit something? I want to use a .netrc file with this inside instead of the ssh keys:

machine github.com
login <login_github>
password <password_github>

Solution

  • This happens because your SSH daemon is not running. You can fix that by running:

    eval `ssh-agent -s`
    ssh-add ~/.ssh/my_git_key_file
    

    Then it shouldn't ask you again about the SSH password.

    If you want to use the .netrc file, use the HTTPS repository url:

    git remote set-url origin https://github.com/owner/repo.git