I am trying to push a file from via Git CMD/Bash and I recently had to change my SSH key and create a new one. I deleted my old key and made a new one to replace it. I am currently trying to push something after successfully setting up the new key. I receive a prompt for my password when I am pushing my file and I enter the password correctly and I receive the error, "remote: Invalid credentials
fatal: Authentication failed for ______."
I am unsure how to go about this I am just trying to push this file to my repository. Thank you for the assistance in advance.
Hi Jordan and welcome to the community!
You mentioned SSH keys, however, the message in the output normally shows when HTTPS authentication is used.
If you navigate to the directory of your clone and run the following command:
git remote -v
does the URL of the repo in the output start with https:// or with git@bitbucket.org ?
If it starts with https://, you will need to change it to an SSH URL in order to use SSH.
You can do that with the command
git remote set-url origin git@bitbucket.org:workspace-id/repo.git
where
origin replace with the name of your remote, if it is different than origin. The name of your remote shows in the output of git remote -v
workspace-id replace with the id of the workspace this repo belongs to
repo replace with the sluf of your repo
If you are using OpenSSH as an SSH client, I would also recommend updating the ~/.ssh/config file on your machine with the following:
Host bitbucket.org
AddKeysToAgent yes
IdentityFile ~/.ssh/{ssh-key-name}
where {ssh-key-name} replace with the name of the private SSH key, whose public key you have added to Bitbcuket.
This will ensure that this specific SSH key will be used every time you clone, pull, or push to a Bitbucket Cloud repo via SSH.
Please feel free to reach out if you have any questions.
Kind regards,
Theodora
Hi, I resolved my issue. Uninstall and reinstall solved my issue. Thank you for the response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's good to hear Jordan, thank you for the update. Please feel free to reach out if you ever need anything else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.