GIT: fatal: Could not read from remote repository when you create new branch
Solution 1
Double-check:
- your GitHub ssh setting
- the exact case (upercase/lowercase) of your url
myName/myRepo.git
-
if the issue persists with an https url
git remote set-url origin https://github.com/myName/myRepo.git
Solution 2
Not sure if OP ever solved his issue or not, but for future references (since this helped myself not too long ago haha), the problem is with the SSH/OAuth authorization. I resolved my situation by replacing the OAuth for terminal access and updating my gitconfig file:
** OSX Sierra Platform **
- Check your config file via the
git config -e
command. - Open your keychain app.
- Search for github.com || org.github.com if you're in an organization's enterprise repo.
- Select the keychain entry appropriate github -- OF TYPE "Internet Password".
- Edit the password via pasting in the OAuth key.
- Exit and retry to push to your repo, which should generate a pop-up asking for keychain access.
- If so, allow access.
- If not then you edited the wrong keychain or something didn't save correctly.
Git is documented on github pretty extensively, so if you run into a hiccup, just give it a quick search on there (or stackoverflow ...) and hopefully it won't be too hard to clear up. People are awesome at helping out, so don't be afraid to ask a dumb question!
Comments
-
user2924482 over 3 years
I'm create new branch and I'm trying to push the branch (I have tried the following commands):
git push --all -u git push origin NewBranch
But in both cases I'm getting this error:
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
This is my .git/config:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = ssh://[email protected]/myName/myRepo.git fetch = +refs/heads/*:refs/remotes/origin/* pushurl = ssh://[email protected]/myName/myRepo.git
This is origin:
origin ssh://[email protected]/myName/myRepo.git (fetch) origin ssh://[email protected]/myName/myRepo.git (push)
Any of you knows why of this error?
I'll really appreciate your help