When I run brew update I get the following error message
$ brew update
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
I am on OS X Yosemite.
GitHub isn't able to authenticate you. So, either you aren't setup with an SSH key, because you haven't set one up on your machine, or your key isn't associated with your GitHub account.
Related
Whenever I try to do a git clone, or a brew install I get the following error:
Not sure what the issue is and I am using ohmysh
==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask` exited with 128.
Follow the instructions here:
https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/utils.rb:266:in `safe_system'
/usr/local/Homebrew/Library/Homebrew/tap.rb:273:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:157:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:103:in `<main>'
The solution provided by OP is certainly a valid workaround, but for more context, the full piece of Git configuration that caused this behavior likely looked something like this:
[url "git#github.com:"]
insteadOf = https://github.com/
This has the effect of forcing any GitHub requests made over HTTPS to instead use SSH. The git#github.com: Permission denied (publickey) notice indicates that you are not set up to use SSH via GitHub.
For some additional background/discussion:
Homebrew community discussion answer
Homebrew GitHub issue
The GitHub docs on Authenticating with GitHub from Git recommend connecting over HTTPS, so if you're fine with that, you can remove the original lines of configuration.
If you would prefer to always connect over SSH, you can keep the configuration as is, and follow the instructions on Connecting to GitHub with SSH.
Answer was in my .gitconfig file.
Had to comment out this line:
# insteadOf = https://github.com/```
I have a git repo on BitBucket for a utility project and i use it as a git submodule in other projects. I wrote an Xcode Build Phase script that clones, initializes and updates the submodule but it fails cloning with this error:
Cloning into '[Location of my working copy]'...
ssh_askpass: exec(/usr/X11R6/bin/ssh-askpass): No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.
I can do a checkout from Xcode's interface, i can do a checkout from the command line, and i can even run the same script from the command line myself, and everything works, i get prompted for my passphrase. Except when the script is run by Xcode.
I contacted BitBucket support and they pointed it out that according to the error Xcode is trying to use /usr/X11R6/bin/ssh-askpass to prompt me for the passphrase of my private key but it can't find the file (i also found that /usr/X11R6 is just a symlink to /opt/X11). They suggested that i check the following links:
https://support.rstudio.com/hc/en-us/community/posts/200660237-Using-Git-with-password-authentication-on-OS-X
https://github.com/markcarver/mac-ssh-askpass
https://github.com/theseal/ssh-askpass
I installed the missing binary from the last link using Homebrew, symlinked it to the location Xcode needs it to be and got a seemingly broken dialog box:
I also tried copying the binary instead of symlinking but it didn't make a difference.
Any ideas?
Just to make sure i ran this test to see if there's a problem with my SSH configs...
$ ssh -vT git#bitbucket.org
...but according to the results everything is OK.
The guys over at https://github.com/theseal/ssh-askpass/ helped me figure this out.
I had to install the missing ssh-askpass then add my SSH key to the agent with ssh-add -c before Xcode was launched. Adding the key while Xcode was running resulted in the Build Phase script always returning an error:
sign_and_send_pubkey: signing failed: agent refused operation
You can read the troubleshooting details here.
In windows when I try git pull origin master, I get this error. But it works when I try from Git Bash.
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
.
This error comes when I try from windows command prompt.
My assumption is that when run outside of Git Bash, git can't find your private key for the repository you are trying to access.
Run echo $HOME in Git Bash and set HOME in Windows command prompt and compare results.
Should /usr/local/bin/brew be owned by root:admin or $USER:admin?
Background: brew update is failing.
$ brew update
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
Error: Failed to update tap: homebrew/dupes
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed
Error: Failed to update tap: homebrew/versions
Already up-to-date.
I've followed both https://github.com/Homebrew/homebrew/issues/10292 and https://github.com/Homebrew/homebrew/issues/9953. My /usr/local/.git and /usr/local/Cellar have $USER:admin permissions.
However, I found out that the brew executable in /usr/local/brew belongs to root:admin. It makes sense to me that it would be $USER:admin instead, but since I don't remember setting it like that I don't want to change it and mess something up.
$USER:admin. Everything should be owned by your user account. Something like chown -R $USER Library/Homebrew should help (the taps have their git repos under Library/Taps).
If you'd like to use Homebrew in a multi-user setup, consider Brewdo.
I am new to Git hub and was able to successfully create an ssh key and upload it to the website however when I type in
git push origin master
I receive the following error:
error: cannot run ssh: no such file or directory
fatal: unable to fork
I am using Cygwin on a windows Vista machine if that is also useful. Ok.. after installing openssh I now get the error:
Permission denied (publickey)
fatal: the remote end hung up unexpectedly
You do not have ssh installed within Cygwin, or it's not in your path. Make sure that you are able to run ssh --version successfully from the Cygwin prompt.
For the second error, this indicates that the key your ssh client is attempting to authenticate with is not trusted by the remote server. Verify that the public key has been successfully added to your Github profile, and also verify that the public key you've added corresponds to the private key you are attempting to use.
you have to install openssh as well. Please re-run the cygwin setup and check openssh