Sourcetree not working with SSH key on Mac upgrade? - macos

I've recently upgraded my Mac to 10.13, I have a sourcetree where it was working fine before the update, now after the update I am not able to push anything to my repositories, although it used to work before, anybody encounter this before?

I found the solution:
Mac upgrade 10.13 involve some changes to OpenSSH policy, you can read about it here: https://developer.apple.com/library/content/technotes/tn2449/_index.html
You will need to add the identity to the list from terminal:
run:
ssh-add -l
you will get "No identity message", you should add you SSH key, run:
ssh-add ~/.ssh/id_rsa
Check that the change is made by running the first command again, then you should see that the key is add.
Now you all set and Sourcetree will push normally.

Related

I can't sign commits from IntellIJ on windows using git from WSL2

Ok, so I have installed WSL2 Ubuntu on my Windows 10 pc. I'm trying to sign a commit from intellij (running as admin) installed on windows, and I'm using the git binary from the WSL2 vm, I have configured the gpg and git stuff in both windows and wsl, but I don't know why this is not working...
Here is a screenshot of the gpg signing working on the wsl vm.
And here I have another picture of the gpg signing working on the windows terminal.
The dialog showed successfully on both terminals asking for my passphrase. Using the git cli the gpg key works:
And this is the error I get:
After some more research I found a workaround:
I found this comment in the YouTrack site. Which led me to this stackoverflow post. The workaround/solution is the following:
Edit the ~/.gnupg/gpg-agent.conf inside your WSL setup and add the following line (or replace it if you already had a config with the same key):
This config will tell gpg to use the windows gui instead of the cli when asking for your passphrase
pinentry-program "/mnt/c/Program Files (x86)/GnuPG/bin/pinentry-basic.exe"
You can keep the program path to the pinentry-basic.exe (that's the default one), but if you have it under another location make sure to change it.
After that you can try the following command and check that the windows pinentry dialog shows up:
This command will sign the text "test" and will ask you for your key passphrase.
echo "test" | gpg --clearsign

How do I unlink my computer from a github account?

I've been able to push with the mac GitHub app to a GitHub repo, but I'm trying to use the command line now and I see this error:
remote: Permission to bfred-it/test.git denied to wildlifela.
wildlifela is a company account that I used recently on a different project, I think I only added my SSH key to that account.
The problem is that even after removing my key from that account (wildlifela), my account (bfred-it), the RSA keys from my computer (with ssh-add -D) and emptying the ~/.ssh folder, I still get that error.
It doesn't seem to be a repo issue: I just created a repo on GitHub.com, cloned it to my desktop, created a commit and git push origin master still produces that error.
After following the Generating SSH Keys procedure, ssh -T git#github.com authenticates me as bfred-it, but I still can't push as bfred-it.
What can I do?
(OSX 10.9)
I worked around this issue by using a different version of git.
Instead of using OS X's git I'm now using homebrew's git and it's working correctly.
If anyone has any insights as to what was happening, please share.
although i removed the ssh keys and the git config files from the OS, it just won't let me clone/pull/push to repositories
Check that the repo is indeed owned by you (for pushing to it)
There always is the option of using https url (with GitHub username/password)
removing the ssh key might not be enough, you also have the ~/.ssh/config file.
As mentioned in the comment, it can depend on your version of Git and on your OS (Windows, Mac or Linux).

Agent admitted failure to sign using the key. OSX

I use GIT Tower to push to a remote repository and also use Terminal to connect to a few amazon AWS instances using key files from my Mac (OSX Mavericks)
For some reason, I've started receiving this error:
Agent admitted failure to sign using the key
I've tried running
ssh-add
I;ve tried resetting the permissions of the file, removed my known_hosts file, everything. Can't get my head round it, I haven't a clue why this has just started, but its very frustrating.
ANY feedback or help would be received with gratitude.
Thanks
Ste
Such kinds of errors may occur due to the incompatibility of OpenSSH. After generating the keys on your home directory, you can fix this error by simply loading your generated keys into your SSH agent with the following command:
>$ ssh-add
Hope this helps.
the culprit is Tower v1.5.3. Had the same behaviour today on my Macs. Downgrading to Tower v1.5.2 helps. If the identity were added with v1.5.3 clear the identities in the SSH Agent (ssh-add -D) before connecting with Tower v1.5.2 again.
Note: You can use Tower v1.5.3, but then your SSH Key must have a passphrase to get this version of Tower to work.
Regards,
Andreas
This is a general problem with the Mac OS update 10.9.2 (see here for a general discussion, outside of Tower: Git push keep getting permission denied after mac 10.9.2 update)
As said before, running "ssh-add -D" on your command line, possibly combined with a restart of your Mac OS should solve the issue.
Tower 1.5.4 is out, with the correct bugfix:
changelog:
Simplify SSH Public Key management after Apple's security update in Mac OS 10.9.2
The way I got around this was to remove all identities. I ran the command
ssh-add -D
The prompt then returns: All identities removed.
I then logged in to my server via SSH and the message disappeared.

I can push with Git Bash, but I cannot with MINGW

I use MINGW32 under Windows 7 and I want to configure Git for that.
I know that there is the Git bash but I would like to use my MINGW32 installation
Right now my problem is that I cannot push my code.
After issuing "git push origin master" it simply stops waiting for something.
Probably is an ssh configuration issue (maybe is not finding the ssh agent?), but I can't figure out what it is.
This is what I see
$ git push origin master --verbose
Pushing to git#github.com:mottalrd/myprj.git
Then nothing happens
Notice that the ssh connection works, in fact if I issue ssh -T git#github.com I get this
$ ssh -T git#github.com
Enter passphrase for key '/home/motta/.ssh/id_dsa':
Hi mottalrd! You've successfully authenticated, but GitHub does not provide shell access.
Thank you
I discovered that this is a very well know problem and that it is related with mintty, which I had installed on top of MINGW
It is called the pty problem. You can browser the MINGW community to find people having this exact problem. I switched to console2 that is a replacement to mintty. This solved my problem

Git fatal: remote end hung up

So I thought I had finally got everything setup on Windows ... then ran into this issue.
Current setup
URL: ssh://user#host:port/myapp.git
Already run Putty - and can connect using valid .ppk keys through the ~/.ssh/authorized_keys direct. In Git and TortoiseGIT - I set both to use "plink.exe".
Putty works fine - no issues - but when I run that URL into bash I get for a git clone (url)
fatal: the remote end hung up expectedly
In a cygwin bash terminal - running "ssh user#host" - works no probs at all.
Anyone suggest anything?
I found out that using ssh.exe from the Git package works every time, as opposed to the ssh that comes with cygwin (the default).
Using this exported variable seems to help; it's slower (2x or more) but it's more stable. Take it as another workaround.
$ export GIT_SSH=/cygdrive/c/Program\ Files/Git/bin/ssh.exe
FYI:
This version of Msysgit comes with OpenSSH 4.6p1, OpenSSL 0.9.8e. [works]
Cygwin's SSH is OpenSSH 5.5p1, OpenSSL 0.9.8n. [doesn't work]
I had the same problem with plink for git under windows.
On run of plink.exe -v xxx#host.com it started to show
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
login as: <<< trouble
Instead of
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using user "xxx"
To resolve this problem I cleaned up the putty registry records and sessions by
putty.exe -cleanup
After that plink starts afresh and asks to trust and store the host again and it is getting connected with no problem !
Try following steps, maybe something will give you a hint on your problem:
1. Run putty and after setting up server name/user name/keys etc. save those settings.
2. Run plink.exe or plinkw.exe like plink.exe user_name#server, (it'll throw some info at you) just to see if plink can connect to the server.
3. Check again that git knows that it should use plink, I'd say with all VCSs, that's the problem people have most often, apart from their keys not being set up properly.
Normally by now most of your ssh problems would be revealed. Now just fix them. :)
Update:
I think the problem you have is caused by several gits you've got installed. For the msysgit and cygwin git you'd need to set the GIT_SSH variable. That's done via either 'set GIT_SSH=c:\path\putty\plink.exe' or 'export GIT_SSH=/your/path/putty/putty.exe' respectively. If you're also using tortoise git, you'd need to locate 'properties' (or is it settings?) in it's menu, and set the ssh client there.
Apart from all that, when specifying git clone URL, use your login name and the server name in there, e.g. 'git clone ssh://user#server/your/path/repo.git User and server names should be used by plink, and plink should be able to connect to the server with those arguments, when all of those requirements are met, you'll be all set.
Good luck.
If you want to try the cygwin openssh 5.4p1-1, which does seem to work for this, unlike 5.5 or 5.6, you can use the cygwin time machine mirrors. Start setup.exe with -X and add a mirror Url, such as:
ftp://www.fruitbat.org/pub/cygwin/circa/2010/05/20/230133
Be careful not to install too much, i.e. base packages, from an older mirror than the rest of your install.
We had same problem and here is solution how we solved the problem:
at first we got:
zajdan#cyberFuture:~$ git clone ssh://nette#19X.16X.14X.7X/~repos/erotika.git/ erotika
Initialized empty Git repository in /home/zajdan/erotika/.git/
Password:
fatal: '/repos/erotika.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
zajdan#cyberFuture:~$
solution:
zajdan#cyberFuture:~$ git clone ssh://nette#19X.16X.14X.7X/~/repos/erotika.git/ erotika
after tilde there must be a slash!
I have exactly the same issue.
I don't use Putty (just Cygwin).
I use Windows 7 Ultimate (fully patched as of this moment).
I just installed Cygwin yesterday.
I made sure binary mounts were being used.
If I copy a git repo to the machine (via samba mount), I can clone it, but when I "git diff" after the clone, there are a bunch of "different" files with no diffs. After a "git status" there was no output from "git diff". It seems like a newline thing, but I can't figure out how that would be happening. (I have igncr in SHELLOPTS, but removing that doesn't fix it.)
I'm completely stumped.
Check the openssh version you're using in CygWin. Version 5.5p1-1 (which is the latest at this time) gave me the same error. Downgrading to 5.4p1-1 fixed the problem.
Another solution would be to use putty/plink instead of openssh.
For more details, see this thread: http://www.mail-archive.com/cygwin#cygwin.com/msg103752.html
I get message: "remote end gung-up, unexpected EOFs, index-pack failed" while cloning git repo but was able to workaround this issue with copssh http://sourceforge.net/projects/sereds/files/Copssh
The root cause is Cygwin openssh package.
I removed original openssh from Cygwin, installed copssh and set GIT_SSH variable to point copssh binaries. After this I simply added copssh binaries in the PATH and now I'm using copssh instead of openssh - there is no difference.
Everything works fine and issue does not appear any more.
The other solution is to use mSysGit package.
I believe the real problem is that cygwin's ssh looks for .ssh in /home/name/.ssh and mingw's git ssh looks for .ssh in c:/user/name/.ssh
Chances are your keys are in one and only one of these directories.
You can trying telling cygwin's .ssh to use a different identity file using the -i switch, or move the keys into both directories, or create an ssh config file in /home/name/.ssh/config.
I created a config that contains:
Host github.com
User jerryasher
Hostname github.com
IdentityFile c:/Users/jerry/.ssh/id_rsa
And given that I can use either the mingw git from git bash or cygwin's git from an rxvt to interact with github.
To correct this issue, run "plink -agent github.com"
Press y when prompted to cache the key. Login as git. You'll automatically be disconnected. And it sould work.
Source: http://devlicio.us/blogs/sergio_pereira/archive/2009/05/06/git-ssh-putty-github-unfuddle-the-kitchen-sink.aspx
Try to use absolute path to repo in a URL, that worked for me.
Instead of:
git ssh://user#host:port/myapp.git
Write:
git ssh://user#host:port//home/user/repo/myapp.git
Notice the double slash!

Resources