Reputation: 3812
I am having trouble pushing my code from git to gerrit. First I checked out the code like so:
git clone ssh://[email protected]:22/path/to/code
Then I tried setting up a push url like so:
git remote set-url --push origin "someotherlocation.com:/path/to/code HEAD:refs/for/master"
When I do git push
it returns this error:
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.
However, if I just type in
git push someotherlocation.com:/path/to/code HEAD:refs/for/master
it gets pushed to the gerrit server. Why is this, and what am I doing wrong? Thanks!
Upvotes: 0
Views: 2155
Reputation: 11581
Your git remote
command sets the push URL to, literally, someotherlocation.com:/path/to/code HEAD:refs/for/master
. A push URL is expected to be just the URL. The push refspec (HEAD:refs/for/master
) is not part of the URL. If the goal is to avoid having to type the refspec every time I suggest you look into setting up a Git alias or investigate the remote.<name>.push
option for .gitconfig (see git-config(1)).
Upvotes: 2