Niklas
Niklas

Reputation: 25433

Push on gerrit with windows

I am struggling to push some of my data to a gerrit with TortoiseGit. I created a new repo and committed it to the master. I added one remote, with my private key and I also uploaded the public key.

Pulling from the gerrit is no problem, but when I try to push the following error occurs:

remote: Resolving deltas: 100% (96/96)
remote: Processing changes: refs: 1, done    
remote: ERROR: missing Change-Id in commit message
remote: Suggestion for commit message:
remote: Initial Commit
remote:
remote: Change-Id: Icb5f79b9a32abc77a99f0034ecc6a5a9ae9ef1c6
remote: Hint: To automatically add a Change-Id to commit messages, install the commit-msg hook:
remote: $ scp -p -P 29418 <server stuff>:hooks/commit-msg .git/hooks/

The big problem is, I am living in a windows world, where is no $ scp .... any suggestions, how I can install git hook or delivering a commit id?

Btw git hooks --install returns 'hooks' is not a git command

Upvotes: 15

Views: 14373

Answers (2)

uncletall
uncletall

Reputation: 6842

Just download it from : http://www.example.com/r/tools/hooks/commit-msg and then copy it to your .git/hooks folder.

Or you can download it from gerrit review

-- Update --

If you add the commit hook after making the commit locally, which is probably the case, you need to amend your last commit. Simply amending the last commit without making any real change will add the Change-ID to your log message.

  1. git commit -a --amend
  2. git log -1 // this is to check that the Change-ID is present in your log message
  3. git push origin HEAD:refs/for/master

-- Update 2 --

If you are like me and have a lot of projects at create clones every now and then you might want to setup your git installation so the commit-msg hook is installed by default. You can do this by copying the commit-msg to your git template folder. On my Win7 system it can be found here:

C:\Program Files (x86)\Git\share\git-core\templates\hooks

The next time you create a new clone you do not need to download the commit-msg again.

Upvotes: 20

Vikram
Vikram

Reputation: 4192

This looks like a case of appropriate hooks not downloaded into your clone.

You can try doing this:

# cd into your clone such that you should be able to see .git folder on ls -a
# for example if you had following structure myclone/myproject/.git
# you have to cd to myclone/myproject directory


$ scp -p -P 29418 <server stuff>:hooks/commit-msg .git/hooks/

Now go to your hooks folder and do ls to see if you have required hooks downloaded.

You don't install any hooks you just copy it from your gerrit repo

Update https://www.mediawiki.org/wiki/Talk:Gerrit/git-review is what you are perhaps looking for

Upvotes: 1

Related Questions