On Linux, everything is clear, generated an ssh key, connected it to the github and everything is fine. But on Windows in such software as rubymine how to use a whale? After I try to push:

git push -u origin master 

gives me

Permission denied (publickey).

I have a rail application. In it is already installed git everything is fine. How to merge through the terminal now into the repository? ssh-key commands do not plow.

I suppose I need to somehow also generate the ssh key or something like that and enter it in the github in the profile?

  • ssh-key команды не пашут - it is possible in more detail how you tried to generate a key, what error message? - Nick Volynkin

2 answers 2

For key authorization to work (without a password):

  1. If you have not yet installed git for Windows, install it .
  2. Generate a key via git bash.
  3. Add the public part of the key to your account on GitHub.

If you want to open git bash from the RubyMine environment, you need to configure it ( translated instruction with enSO ):

  1. File menu → Settings → (Enter 'Terminal' in the search bar).
  2. In the settings window that opens, change the value of the Shell path to:

     "C:\Program Files (x86)\Git\bin\sh.exe" --login -i 

    Perhaps you should try Git for Windows . In addition to the graphic shell, this package includes bash emulation. When installing, you will be offered three options:

    • separate bash console
    • minimal set of UNIX commands for use in the Windows command line
    • full UNIX-environment in the Windows command line (changing the behavior of a number of commands, such as find and sort ).

    The home directory will be your User-directory, in which you can create a subfolder .ssh and put your keys, as in a UNIX-like operating system.

    If the keys are not automatically picked up from the directory, you can install a Windows-SSH agent. To work with SSH, Windows has a set of Windows utilities , including the well-known PyTTY. It has the utility puttygen.exe , which allows you to either generate a new key or convert an existing UNIX key. This key can be loaded into the pageant.exe agent, which will hang in the tray and provide the key for SSH operations, like the ssh-agent on UNIX. Yes, unfortunately, this will lead to the fact that in UNIX and Windows you will have different private keys, but due to the conversion, you can ensure that the public key is the same.

    • Does it make sense to use the same keys on several machines? You can always add a few public ones. - Nick Volynkin
    • Yes, it does, if you have to work with several hosts to which there is no access and to which access is granted by administrators (by certain people who may make mistakes, leave, etc.). As soon as two or more keys appear, problems begin. And so one person - one key, if access is opened to the wheelbarrow, you can be sure that there is exactly the key that is needed (and not one of them). If there is no access, it will be debugged faster. Probably it strongly depends on working conditions, teams, teamwork. - cheops
    • You forgot to mention @NickVolynkin. - ߊߚߤߘ
    • @Arhad, Nick is a moderator and a top git responder, I think he will not miss the answer) - cheops
    • @cheops I, for paranoid reasons, keep different keys on different machines. He quit - he deleted the keys to the working machine from everywhere, but they remained from his personal laptop. But your argument is also clear to me. - Nick Volynkin