Git login-Configuring user and password with Git Bash

DevOps

I am using Git Bash on Windows 7. We are using GitHub as our repository origin.

Every time I push or pull I have to provide user and password credentials. I know that my SSH keys are set up correctly, otherwise, I would not be able to access the repository. (That is, once I enter my credentials the push/pull works correctly.)

I have entered

git config --global user.name myusername

git config --global user.email myemail

git config --global github.user myusername

git config --global github.token mytoken

But I am being asked for credentials each and every time I push/pull.

 
 

2
Answers

Replies

If you do not want to access GitHub repositories without giving your credentials, Git has a credentials system that can help you with this. The 'store' mode will access the credentials from a text file. Add your credentials to a text file and give it to the git command as follows.



$ git config --global credential.helper 'store --file ~/.credentials-file'

 

When an HTTPS URL is used for accessing the GitHub repository, it will ask for a username and password. It does not ask for the username and password for the SSH URL. You can check the config file of git using the below commands.



.git/config



git config -e



If it has an HTTPS URL, replace it with SSH.

 
 

If you want to unleash your potential in this competitive field, please visit the DevOps course page for more information, where you can find the DevOps tutorials and DevOps frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.