Git Authentication Failed, remote: invalid username or password - github

I am trying to push some edits from my local repo to my GitHub but I get this error:
(base) herasyed#MacBook-Air-3 MechaCar_Statistical_Analysis % git add .
(base) herasyed#MacBook-Air-3 MechaCar_Statistical_Analysis % git status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: .DS_Store
renamed: MechaCarChallenge.R -> R Code/MechaCarChallenge.R
(base) herasyed#MacBook-Air-3 MechaCar_Statistical_Analysis % git push
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/herasyed/MechaCar_Statistical_Analysis.git/'
I can pull from my Git fine and my SSH key seems to be working.

my SSH key seems to be working.
Your SSH key is not used at all, considering the remote URL used is an HTTPS one.
If you want to use SSH:
cd /path/to/repo
git remote set-url origin git#github.com:herasyed/MechaCar_Statistical_Analysis.git
git push
See if the push succeeds then.

Related

Github SourceTree unable to push

I've cloned github repository with SourceTree.
During installing SourceTree I've authentificated with my GutHub account.
After cloning I've made first changes and trying to commit and push. Commit works fine, but push throws exception:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin master:master
remote: Permission to KamikyIT/VkWCF.git denied to sergeypyrkin.
fatal: unable to access 'https://github.com/KamikyIT/VkWCF.git/': The requested URL returned error: 403
Pushing to https://github.com/KamikyIT/VkWCF.git
What I can see is that I am not sergeypyrkin.
Check in command-line your credential helper:
git config credential.helper
Depending on your OS, that helper might have cached the wrong credentials (wrong username/password) associated to github.com

Unable to push changes into gerrithub.io

I have the repo here Link to the repo
I cloned it and did some changes but when I try to push it.
It gives me the following error:
$ git push origin HEAD:refs/for/master
Username for 'https://review.gerrithub.io': ardyflora
Password for 'https://ardyflora#review.gerrithub.io':
fatal: Authentication failed for
'https://review.gerrithub.io/ardyflora/virginPulseAuto/'
I have even added the ssh key. Any pointer or help will be appreciated :)
Authentication failure for HTTPS. Better you can take a try with SSH.
Copy the URL for SSH of your repository using a browser and update your local origin.
$ git remote set-url origin <ssh-clone-url>
$ git push origin HEAD:refs/for/master

How do I add my repos to another persons repo?

I have a microservices application, so the front-end on the first repo and two different backend APIs on two different repos. I want to add all these to someone else's empty repo and I am not sure how to do this.
I tried doing a git remote add of the other persons repo and I get this:
danales-MacBook-Pro:freelance-camp-fe danale$ git remote add https://github.com/Meridian-Business-Centers/Interview-Sample-App.git
usage: git remote add [<options>] <name> <url>
-f, --fetch fetch the remote branches
--tags import all tags and associated objects when fetching
or do not fetch any tag at all (--no-tags)
-t, --track <branch> branch(es) to track
-m, --master <branch>
master branch
--mirror[=<push|fetch>]
set up remote as a mirror to push to or fetch from
When I do a git remote add microservice master I get this error:
danales-MacBook-Pro:freelance-camp-fe danale$ git push microservice master
remote: Permission to Meridian-Business-Centers/Interview-Sample-App.git denied to ldco2016.
fatal: unable to access 'https://github.com/Meridian-Business-Centers/Interview-Sample-App.git/': The requested URL returned error: 403
I tried pushing it to my own forked version and got this error:
danales-MacBook-Pro:freelance-camp-fe danale$ git remote add microservice https://github.com/ldco2016/Interview-Sample-App.git
fatal: remote microservice already exists.
danales-MacBook-Pro:freelance-camp-fe danale$ git push microservice master
To https://github.com/ldco2016/Interview-Sample-App.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ldco2016/Interview-Sample-App.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
danales-MacBook-Pro:freelance-camp-fe danale$ git push -u microservice master
To https://github.com/ldco2016/Interview-Sample-App.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ldco2016/Interview-Sample-App.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Go into every separate repo and add a remote (say, personal) with the url of other persons empty github repo. Now push the code like git push personal master.
Say, you have repo1, repo2 and repo3. And a personal repo perRepo (want to add repo1, repo2 and repo3 codes here).
# Go into repo1
$ git checkout master
$ git remote add personal <perRepo-url>
$ git push personal master
# Go into repo2
$ git checkout master
$ git remote add personal <perRepo-url>
$ git push personal master
# Go into repo3
$ git checkout master
$ git remote add personal <perRepo-url>
$ git push personal master
Add Submodule: General command: git submodule add <git#XXX:YYY> <externals>.
git submodule add: Simply tells Git we are adding a submodule
git#XXX:YYY: External repository URL that is to be added as a submodule
externals: This is the path where the submodule repository will be added to the main repository.
More Submodule
Add repo1, repo2 and repo3 as submodule of perRepo.
# Go into perRepo
$ git submodule add <repo1-url> <path>
$ git submodule add <repo2-url> <path>
$ git submodule add <repo3-url> <path>
$ git submodule update --init --recursive
N.B. when repo1/repo2/repo3 would be updated you need to run git submodule update command to get the updated changes into perRepo repo.

Github- repository is on remote but not found when pushing

I'm trying to push something to github and I'm getting this error;
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git push -u origin master
fatal: repository 'https://github.com/BitMechanic/Stanford-CS106b/Huffman.git/' not found
Then when I check I get this;
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git remote add origin https://github.com/BitMechanic/Stanford-CS106b/Huffman
fatal: remote origin already exists.
Robbies-MacBook-Pro:assn-6-huffman-mac user$ git remote -v
origin https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
(fetch)
origin https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
(push)
Anyone know what I'm doing wrong?
The proper url to use (for cloning and then pushing through origin) is
https://github.com/BitMechanic/Stanford-CS106b.git
not:
https://github.com/BitMechanic/Stanford-CS106b/Huffman.git
Stanford-CS106b is a repo, listed in the BitMechanic's repo page of d. Stanford-CS106b/Huffman is not.
To fix this, see git remote commands:
git remote rm origin
git remote add origin https://github.com/BitMechanic/Stanford-CS106b.git
or, simpler:
git remote set-url origin https://github.com/BitMechanic/Stanford-CS106b.git
Can you paste the
$cat .git/config
output here for reference.
Sometimes it is better to remove the remotes that are misbehaving from there and re-add it using the git remote add command again.

The remote end hung up unexpectedly

I installed Git and ran the set up my username and email.
git config --global user.name "Your Name"
git config --global user.email username#gmail.com
Add your public key
Next, I created a project directory called 'projectname' and committed this to a remote Git server.
mkdir projectname
cd projectname
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git#github.com:projectname/projectname.git
git push origin master
My public key has been added to the github website.
When I try to commit I get this error message:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Any suggestions? - I am working with Ruby on Rails
Make sure you copy past the SSH key exactly like it's in the xxxx.pub file do not add lines or spaces to it.
Try again or delete both public and private keys and generate them again. It should work. Also remember to update the pub key again on Github website.
Also test your existing key with this command
ssh -T git#github.com