Git - Authentication issues
Authentication issues
If you are using a Windows machine and if you are using https method for connecting to Git, and if you need to updated the password for Git, an easy way would be to use Windows Credential Manager. Control Panel -> Credential Manager -> Windows Credential -> Git
and update the password there.
If you need to set the username and password, use this command: git remote set-url origin https://<username>:<password>@github.com/<details-about-the-repository>.git
If there are special characters in your password, do not forget to replace them with their ASCII Encoding Reference.
Look at this for reference: Special characters in proxies
git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
A Permission denied
error means that the server rejected your connection.
Resolution 1 : git remote set-url origin https://n0281526@git.forge.lmig.com/scm/uscm-esales/services-policywriting.git
Resolution 2 :
If you generated the keys yourself from your client machine, do not forget to add them to the SSH agent using the command ssh-add
.
Run ssh-add on the client machine, that will add the SSH key to the agent.
To figure out where your client’s SSH agent is looking for private and public keys, use this command: ssh -vT git@github.com
This will show the list of the directories that your computer’s SSH agent is looking in for public and private keys. If everything looks good with this command, you are pretty much set to push and pull from the remote repositories.
You can change the protocol that your local repository is using to communicate with the remote repository : It can be HTTPS or SSH. The issue with using HTTPS URL is, every time you want to push a change, it might ask you for username and password. With SSH, you don’t have to enter username and password every single time.
Use these commands to switch between the two :
-
If you want to use HTTPS:
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
If you got authentication issues with the GIT console you can try your auth this way:
https://<username>:<password>@bitbucket.org/<username>/<repo>.git
-
If you want to use SSH, follow this: