brackets-userland/brackets-git

Cannot acess to my private git repo. I have a password but cannot find were i can insert the password to acess the GIT repo.

voxelshaper opened this issue · 14 comments

[Please describe your problem here]


Brackets 0.38.0-12606 (mac), Git 1.9.2 & Brackets-Git 0.13.15

Error: Cloning into '.'...
ssh: Could not resolve hostname admin: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
call: git clone ssh://***.git . --progress
Error: Cloning into '.'...
ssh: Could not resolve hostname admin: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at Object.exports.toError (file:///Users/WhiteCat/Library/Application%20Support/Brackets/extensions/user/zaggino.brackets-git/src/ErrorHandler.js:158:19)
    at NodeConnection.<anonymous> (file:///Users/WhiteCat/Library/Application%20Support/Brackets/extensions/user/zaggino.brackets-git/src/Cli.js:177:54)
    at j (file:///Applications/Brackets.app/Contents/www/thirdparty/thirdparty.min.js:550:26676)
    at Object.k.fireWith (file:///Applications/Brackets.app/Contents/www/thirdparty/thirdparty.min.js:550:27489)
    at NodeConnection._receive (/utils/NodeConnection.js:486:34)

You need to use https instead of ssh with this extension or manage your password with some git password manager like https://help.github.com/articles/updating-credentials-from-the-osx-keychain

no https for me. Well could not fixed this with the git-credentials-osxkeychain. Seems that i always get permissions denied. Even if i create everything under admin.
So no luck for me.

Does the cloning using terminal work for you? You can clone using terminal and then work with it in Brackets.

Yes that works perfectly Martin. The terminal does it.
Though with the terminal solution I don’t need the GUI of this extension inside Brackets. For that i will keep with the terminal.

But let me say that is a nice extension ;)
Congrats. Keep the good work.

Cheers.

No dia 19/05/2014, às 02:11, Martin Zagora notifications@github.com escreveu:

Does the cloning using terminal work for you? You can clone using terminal and then work with it in Brackets.


Reply to this email directly or view it on GitHub.

Well the main goal of the extension is to provide ability to commit, view diffs and see changes, history and so on. Remote operations do work well with HTTPS protocol but don't work with password protected SSH due to nature of Git implementation which we cannot change.

Hi Martin, just to add this comment about the workaround to make this work.

-> Mac

  • create a ssh pair key with the following command on the terminal
    $ ssh-keygen -t rsa -b 2048 -C "MyCommentedKey"
    (Enter twice because we dont need password)
  • Now add the sshkeyfilename.pub to the authorized_keys onto the git server. (see some tutorial about this, it is simple)
  • Keep the private file (sshkeyfilename) on your mac, and now add this private key via terminal like this:
    $ chmod 600 sshkeyfilename
    $ ssh-add sshkeyfilename

-> Windows (Go to point 3 if you have already a rsa key already generated)

  • create a ssh pair key with PuttyGen RSA with 2048 bytes. Don't add any password. Save the PPK and upload the public key to the git server.
  • Add the PPK key to the Putty agent.
  • ONLY IF YOU HAVE A RSA Key already from the server. You need to convert the private key to PPK. With PuttyGen load the sshkeyfilename (this file comes without extension, after loaded Save it as private key. After that load this key in Putty Agent.
  • Insert (if not already) the pub key to the server inside the folder /root/.ssh/authorized_keys. (edit with "vi" the file authorized_keys and paste the pub key content on the file.)
  • Putty manage the private keys with a SSH agent always present in the task bar.

Remarks:
In the git server on a Synology NAS server (that was my previous experience) create the folder .ssh inside the folder root.
After that create a file named authorized_keys. Its in this file that you need to copy the content of the pub key.
In windows and mac the procedures are almost the same. Only the PPK file (private key in Windows) is different from the private key on Mac. In Windows you need to convert or create with Putty the key and add the key to the Putty Agent (it automatic when you try to open the key). In Mac you need to add the key at the terminal.

After this we can push/pull everything onto our private git server.
Nice extension like i said. :)

Thanks - This should probably go into readme or docs :)

Thanks for that @eduardomcrodrigues, I also found https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git from Bitbucket helpful in setting up SSH.

I can push/pull just fine with Git Bash now, but not so with "git" through the Command Prompt. I can't manage to set brackets-git to use Git Bash: "C:\Program Files (x86)\Git\bin\sh.exe" --login -i

Any ideas? Thanks.

You can only use a valid git executable with brackets-git, not a shell one. So on Windows it'll be git.exe.

You can use ssh-keygen -t rsa -b 2048 -C even with Windows using the Bash terminal (the one used by Git).

OK, fair enough @zaggino. I was able to get SSH working in windows command prompt with https://github.com/msysgit/msysgit/blob/master/git-cmd.bat though - not sure if that changes anything... I will just stick to opening bash when I need to interact with remote repositories.

This may be useful to someone else - I was able to get SSH working with brackets-git by setting an environment variable HOME to %USERPROFILE%, per the batch script I referenced previously.

home-environment-variable

On Windows I wasn't able to push/pull from ssh protected remote repositories until setting an environment variable GIT_SSH to C:\Program Files (x86)\PuTTY\plink.exe (provided PuTTY/plink is installed).

Prior to this I was getting an the Error: cmd-spawn-timeout: error, and attempting to push via bash I was being prompted for a password, despite having the Putty Agent running with the proper key loaded.

I followed laubsterboy's post on Jul 30, 2015, at 10:18 AM EDT, which seemed to help! I did get stuck at another stage however, and had to fix another part of my environment.
Here are the steps I followed:

I first set the GIT_SSH variable according to laubsterboy's post.
Then I tested using a git pull, and received this error message:

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
Connection abandoned.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I then executed this command from the terminal $GIT_SSH git@github.com, and entered 'y' to store this server's key.

After this I had the strangest error with Pageant finding a matching key that would not work on GitHub. Here is the error I had so it can be searched:

Reading private key file "....ppk"
Pageant is running. Requesting keys.
Pageant has 3 SSH-2 keys
Pageant key #1 matches configured key file
Using username "git".
Trying Pageant key #1
Server refused our key
Disconnected: No supported authentication methods available (server sent: public
key)
FATAL ERROR: Disconnected: No supported authentication methods available (server
 sent: publickey)

I found with this that it was using a key file I had specified in PuTTy under the "(Default Settings)" saved session that exists from installation of that program, and plink had read this session configuration to only use that single file. I had removed the key from Pageant in earlier testing, but it did not work when it was added then either, so it probably tried to only use that one key then as well.

Removing this key entry in the PuTTy default session configuration allowed plink to find the right key from the list in Pageant, and successfully communicate with my repository on GitHub!