2014-07-15 48 views
5

Il mio repository è su Bitbucket. Ho una macchina Ubuntu che utilizzo come un server di sviluppo (che ospita una copia locale di tutto il mio codice, apache, php, git ecc.). Lo sviluppo effettivo viene eseguito su una macchina Windows nella stessa LAN. Uso una condivisione Samba per accedere direttamente ai file sul server. Io uso PHPStorm come mio IDE. Ho installato git anche sulla macchina Windows, per poter utilizzare git integration in PHPStorm. E funziona: posso leggere la cronologia dei repository e commettere nuove modifiche senza problemi.Impossibile inviare a git da windows/phpstorm

Ma ora voglio spingere (anche a bitbucket) da PHPStorm. E questo è ciò che fallisce.

Al momento, ho bisogno di accedere al mio server Ubuntu per inviare il codice da lì. Ma mi piacerebbe essere in grado di psuh da PHPStorm. Probabilmente ha a che fare con gli ssh-key che devo integrare, ma non so come. PhpStorm mi dice il seguente:

19:22:10.873: git push --progress origin master:master 
java.io.IOException: Authentication failed: 
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:283) 
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:157) 
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137) 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights 
and the repository exists. 

ho già creato una coppia di chiavi SSH e mettere la chiave pubblica sul Bitbucket. Non so proprio dove andare da qui.

+1

PHPStorm ha accesso alla chiave privata e le è stato richiesto di utilizzare la chiave per l'autenticazione? – EEAA

risposta

9

La pagina PhpStorm git Integration uomo fa menzione:

  • ssh keys are generated outside PhpStorm. You can follow the instructions from http://inchoo.net/tools/how-to-generate-ssh-keys-for-git-authorization/ or look for other guidelines.
  • Store the ssh keys in the home_directory \.ssh\ folder. The location of the home directory is defined through environmental variables:
    • $HOME for Unix-like operating systems.
    • %userprofile% for the Microsoft Windows operating system.
  • Make sure, the keys are stored in files with correct names:
    • id_rsa for the private key.
    • id_rsa.pub for the public key.
+0

Grazie, è stato un ottimo tutorial :) Ho seguito uno sbagliato a quanto pare. – onok

+2

Se si utilizzano più chiavi, è possibile associarlo con '% userprofile% /. Ssh/config' per specificare quale chiave si desidera utilizzare per quale server. – codemonkee

+0

Solo un avviso per chi cambia il percorso della cartella del desktop: PHPStorm cercherà le chiavi SSH nella /. Ssh – rmontagud

1

Se si utilizza l'opzione eseguibile SSH nativo in PhpStorm & legato alla plink.exe fornito con stucco, è necessario connettersi al server host, almeno una volta al accetta la chiave host del server. Una volta che la chiave è memorizzato nella cache è quindi possibile aggiungere la propria chiave privata in pageant.exe

plink.exe [email protected] 
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 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 
If you trust this host, enter "y" to add the key to 
PuTTY's cache and carry on connecting. 
If you want to carry on connecting just once, without 
adding the key to the cache, enter "n". 
If you do not trust this host, press Return to abandon the 
connection. 
Store key in cache? (y/n) y 
Using username "git". 
Server refused to allocate pty 
Hi username! You've successfully authenticated, but GitHub does not provide shell access. 
+0

questa è stata la chiave del mio successo! ma, sto usando un built-in, continua a battere sul nativo. Ho determinato che JetBrains sta usando il putty o una sua versione come quella incorporata. – chiliNUT

+0

Domanda: 'se si sta utilizzando l'opzione eseguibile SSH nativa in PhpStorm e collegata a plink.exe' ** Come si dice a JetBrains di usare plink .exe come client ssh nativo? ** – chiliNUT

11

Se i comandi Git lavorare da linea di comando, ma non da dentro WebStorm, si potrebbe provare a cambiare la configurazione WebStorm da usare "Native" invece dell'eseguibile SSH "integrato".

Per fare questo, scorrere i menu per File -> Impostazioni -> Controllo versione -> Git e quindi modificare il file eseguibile impostazione discesa SSH "Native"

+0

Weird ... I comandi Git funzionano dalla riga di comando, non dentro phpStorm. MA ho dovuto passare da "Built-in" a "Nativo" !! E ora funziona ... Tutto sommato, mi hai aiutato x) – LittleBigDev

0

Ho avuto questo problema. Le mie chiavi ssh erano perfettamente perfette mentre le usavo con Git Bash (Windows).

Ho eliminato known_hosts da cartella C: \ Users \ Your User Name \ .ssh e PHPStorm lo ha creato da solo e ha iniziato a funzionare.

Sul mio altro progetto, si stava dando seguente errore:

java.io.IOException: There was a problem while connecting to 158.xxx.xxx.xxx::22 
    at com.trilead.ssh2.Connection.connect(Connection.java:791) 
    at com.trilead.ssh2.Connection.connect(Connection.java:577) 
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:171) 
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137) 
Caused by: java.net.UnknownHostException: 158.xxx.xxx.xxx:: invalid IPv6 address 
    at java.net.InetAddress.getAllByName(InetAddress.java:1169) 
    at java.net.InetAddress.getAllByName(InetAddress.java:1126) 
    at java.net.InetAddress.getByName(InetAddress.java:1076) 
    at com.trilead.ssh2.transport.TransportManager.createInetAddress(TransportManager.java:165) 
    at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:340) 
    at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:449) 
    at com.trilead.ssh2.Connection.connect(Connection.java:731) 
    ... 3 more 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights 
and the repository exists. 

E si è rivelato l'URL remoto del mio progetto GIT è stato fissato male:

ssh://[email protected]:/home/user/myrepo 

dovrebbe essere:

[email protected]:/home/user/myrepo 
+0

dove hai cambiato questo? – invalidusername

+1

Puoi cambiarlo usando questo comando: git utente di origine set-url remoto @ ip:/your_repo –

Problemi correlati