last day (15 days later) » 

10:58 AM
0
A: configuring git/ssh to access bitbucket results in keyfile rejected - format error?

VonCTry and regenerate your keys with: ssh-keygen -t rsa -C "my@email.com" -m PEM -P "" -f D:\Ian\keyfiles\ianhobson-bitbucket Then add the public key to your BitBucket profile. Make sure your ~/.ssh/config file references that private key Host bitb Hostname bitbucket.org User git Id...

 
Ian
I tried it, not expecting it to work - the old key works from another machine. However I did get logged in so a small step forward. Thanks for that. However "git pull" still fails with "FATAL ERROR: No supported authentication methods available (server sent: publickey)". Not there yet.
 
@Ian What is your git remote -v remote URL used by git pull? And what is the exact content of your ~/.ssh/config file?
 
Ian
Config file is: \nHost bitbucket.org\n Hostname bitbucket.org\n IdentityFile D:\Ian\keyfiles\ianhobson-bitbucket2
Remote URL is: url = git@bitbucket.org:IanHobson/<repo>.git
 
@Ian OK, you can add the User, and only use bitbucket.org. I would use a different name for the host, just to be usre to be using the config settings.
@Ian Next stop is to check if you have properly registered your public SSH key D:\Ian\keyfiles\ianhobson-bitbucket2.pub, in one line (and not three separate line during the copy paste)
 
Ian
Not sure how to do either of those.
Hi, Thanks for joining me
 
11:00 AM
I mean you did register your public key on your Bitbucket profile, right?
(Hi there)
 
Ian
Yes I did
I actually used a new keyfile, so that the old one remains - it works on the old machine
 
The usual trap is to copy that key while keeping <newline> embedded in it. I prefer to copy it in an editor first, with number of line displayed, and make sure the public key is copied as one line. Thn I copy it to the remote Hosting service profile, SSH section.
 
Ian
I think I did it correctly. When I try ssh -v git@bitbucket.org it ends up telling me I can use git or hg to contact bitbucket.
It also claimed I was logged in with the correct username.
 
Oh OK, so that part is working
The git pull is not though
That is why I prefer using an odd name for the Host entry in the .ssh/config: to be sure that I am using the ~/.ssh/config setting
 
Ian
Yes. Git pull fails "FATAL ERROR: No supported authentication methods available (server sent: publickey)"
 
11:06 AM
Can you try
cmd /V /C "set "GIT_SSH_COMMAND=ssh -v"&& git pull"
 
Ian
And then?
 
Warning: no space between ssh -v" and &&
The idea is to see in the verbose output what would be the cause of the error
For instance, that it does not read the proper Host entry in the ~/.ssh/config file
 
Ian
I'm on windows. That looks like a bash command
 
No it does not
pure CMD command
 
Ian
Ian@Helike MINGW64 /m/websites/coachmaster (master)
$ cmd /V /C "set "GIT_SSH_COMMAND=ssh -v"&& git pull"
Microsoft Windows [Version 10.0.18362.418]
(c) 2019 Microsoft Corporation. All rights reserved.

M:\websites\coachmaster>
 
11:09 AM
You are in a bash session
you can revert to a simple CMD session for that
But
 
Ian
gitbash - yes.
 
If you want to remain in a bash session
that would be
GIT_SSH_COMMAND="ssh -v" git pull
(simpler syntax there)
I have to leave for 15 minutes: I'll be back shortly
 
Ian
Ian@Helike MINGW64 /m/websites/coachmaster (master)
$ GIT_SSH_COMMAND="ssh -v" git pull
OpenSSH_8.0p1, OpenSSL 1.1.1c 28 May 2019
debug1: Reading configuration data /c/Users/Ian Hobson/.ssh/config
debug1: /c/Users/Ian Hobson/.ssh/config line 1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to bitbucket.org [18.205.93.0] port 22.
getaddrinfo: atch: Name or service not known
debug1: Connecting to bitbucket.org [18.205.93.1] port 22.
getaddrinfo: atch: Name or service not known
So something regarding DNS?? I tried ping and got
$ ping bitbucket.org

Pinging bitbucket.org [18.205.93.1] with 32 bytes of data:
Request timed out.
Request timed out.

Ping statistics for 18.205.93.1:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),
Control-C

Ian@Helike MINGW64 /m/websites/coachmaster (master)
so resolver works.
 
Ian
11:32 AM
The router is inbound: reject, outbound accept - so no shaping there.
Tried with windowd firewall off - same result.
 
11:49 AM
atch: Name or service not known
That does not look good
Can you rename the Host entry to bitb
And your remote URL in your repo
git remote set-url origin bitb:IanHobson/<repo>.git
Make sure to add User git in your bitb entry in ~/.ssh/config
atch: Name or service not known
I suspect putty being involved
What is the result of, in a CMD (not git bash) set GIT
Do you have GIt_SSH environment variable?
Which would reference putty?
 
Ian
I did, and I have removed it - no change
 
What is the result of, in a CMD (not git bash) set GIT
Do you have GIt_SSH environment variable?
Which would reference putty?
Oh sorry, I misread
I confirm: no putty shuld be involved.
Can you try again your git pull in a simple CMD
(no git bash)
But with a simplified PATh
 
Ian
set GIT gives variable GIT not defined
 
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\cmd;%GH%\mingw64\bin;%PATH%
 
Ian
12:04 PM
So the middle line should be
set GH="C:\Program Files\Git"
C:\Users\Ian Hobson>M:

M:\>cd websites

M:\websites>cd star

M:\websites\star>set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\

M:\websites\star>set GH="C:\Program Files\Git"

M:\websites\star>set PATH=%GH%\bin;%GH%\usr\bin;%GH%\cmd;%GH%\mingw64\bin;%PATH%

M:\websites\star>git pull
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
 
Are you in a corporate environment?
 
Ian
I have a plink environment variable!
SVN_SSH=C:\Program Files\PuTTY\plink.exe
No - Home, workspace HCS
Might it help to remove SVN_SSH?
 
It should not matter for Git
But that is why I use a simplified PATH
to not take more than I actually need
Can you display the result of
git remote -v
 
Ian
in command or git bash?
 
CMD with the simplified path
 
Ian
12:12 PM
M:\websites\star>git remote -v
origin git@bitbucket.org:IanHobson/star.git (fetch)
origin git@bitbucket.org:IanHobson/star.git (push)

M:\websites\star>
 
can you type
git remote set-url origin bitb:IanHobson/star.git
And then display the result of
type %USERPROFILE%\.ssh\config
 
Ian
In the .ssh/config file, which line should be bitd?
 
Host, but it would help if I can see the content of the config file first
 
Ian
Host bitb
Hostname bitbucket.org
IdentityFile D:\Ian\keyfiles\ianhobson-bitbucket2
 
Can you add
User git
After IdentityFile
(next line)
 
Ian
12:16 PM
Done
 
Can you type check (and copy-paste) the rsult of
ssh bitb
 
Ian
M:\websites\star>git remote set-url origin bitb:IanHobson/star.git

M:\websites\star>type %USERPROFILE%\.ssh\config
The system cannot find the file specified.
Error occurred while processing: C:\Users\Ian.
The system cannot find the path specified.

M:\websites\star>
M:\websites\star>ssh bitb
PTY allocation request failed on channel 0
logged in as IanHobson

You can use git or hg to connect to Bitbucket. Shell access is disabled
Connection to bitbucket.org closed.

M:\websites\star>
 
type "%USERPROFILE%\.ssh\config" would work if your profile has a space in it
"logged in as IanHobson": good
can you type
in your local repository
 
Ian
M:\websites\star>type "%USERPROFILE%\.ssh\config"
Host bitb
Hostname bitbucket.org
IdentityFile D:\Ian\keyfiles\ianhobson-bitbucket2
User git
M:\websites\star>
 
where a git remote -v should return
bitb:IanHobson/star.git
can you type there
git ls-remote origin
 
Ian
12:20 PM
M:\websites\star>git ls-remote origin
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
getaddrinfo: atch: Name or service not known
M:\websites\star> git remote -v
origin bitb:IanHobson/star.git (fetch)
origin bitb:IanHobson/star.git (push)

M:\websites\star>
I've an idea - last week, after installing windows 10, I went on-line to find things to turn off for privacy. Could I have disabled something that is needed.
 
Maybe, I am not familiar with those settings
 
Ian
I saw that while you were out.
I have take up enough of your time. Let me reset windows keeping my files and see if that helps.
s/take/taken/
Thanks for all your efforts.
 
 
7 hours later…
7:16 PM
Yes, sorry, I was at work and could no longer participate in any chat
How did it go?
 

last day (15 days later) »