2013-07-10 3 views

risposta

16

Dipende dall'url remoto che hai utilizzato.

If git remote -v rendimenti:

https://github.com/username/reponame 

Poi la configurazione ssh non importa. Ma questo dovrebbe funzionare:

ssh://[email protected]:username/reponame 

Un'altra causa è legata alla propria chiave privata: se si tratta di pass-frase protetto, con un carattere speciale in esso, che di solito non funzionano bene.
See here for other ssh causes of failure.


per sostituire il vostro nome a distanza origin, utilizzare git remote comandi:

git remote set-url origin ssh://[email protected]:username/reponame 

(come spiegato nel GitHub help page circa changing the rmeote url)

Se vedete ::

ssh: Could not resolve hostname github.com:amangupta052: 
    Name or service not known 
fatal: The remote end hung up unexpectedly 

Prova la sintassi non-scp ssh:

git remote set-url origin ssh://[email protected]/username/reponame 

(notare il '/' al posto del ':' dopo github.com)

Forse questo avrebbe funzionato, come commented in this blog post: sintassi

git remote set-url origin [email protected]:username/reponame 

(SCP-like, ma senza la ssh:// prefisso)

Come I mention here, una sintassi sCP generalmente si intende un ~/.ssh/config file per funzionare correttamente.

+0

Ok così la mia origine è https uno, come posso ottenere l'origine ssh? Mi dispiace davvero di essere nuovo. –

+0

@AmanGupta nessun problema, ho modificato la mia risposta. Sostituisci ''username'' e '' reponame'' con i valori appropriati. – VonC

+0

Ok, ho impostato la nuova origine. Ottengo ssh facendo git remote -v. Ma ora, ottengo 'ssh: Impossibile risolvere il nome host github.com:amangupta052: Nome o servizio non noto fatale: L'estremità remota riattaccava inaspettatamente' facendo' git push' –