git push para servidor gerrit não funciona ao definir git remote set-url --push, mas funciona se eu digitar o URL manualmente

StackOverflow https://stackoverflow.com//questions/22003362

  •  20-12-2019
  •  | 
  •  

Pergunta

Estou tendo problemas para enviar meu código do git para o gerrit.Primeiro verifiquei o código assim:

git clone ssh://user@location.com:22/path/to/code

Então tentei configurar um URL push assim:

git remote set-url --push origin "someotherlocation.com:/path/to/code HEAD:refs/for/master"

Quando eu faço git push ele retorna este erro:

fatal: '/path/to/code HEAD:refs/for/master': not a Gerrit project
fatal: Could not read from remote repository.

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

No entanto, se eu apenas digitar

git push someotherlocation.com:/path/to/code HEAD:refs/for/master

ele é enviado para o servidor Gerrit.Por que isso acontece e o que estou fazendo de errado?Obrigado!

Foi útil?

Solução

Seu git remote comando define o URL push para, literalmente, someotherlocation.com:/path/to/code HEAD:refs/for/master.Espera-se que um URL push seja apenas o URL.O push refspec (HEAD:refs/for/master) não faz parte do URL.Se o objetivo é evitar ter que digitar o refspec toda vez, sugiro que você configure um alias do Git ou investigue o remote.<name>.push opção para .gitconfig (veja git-config(1)).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top