Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 638
Niklas Avatar asked Jul 18 '13 00:07

Niklas


1 Answers

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.

like image 120
uncletall Avatar answered Oct 21 '22 22:10

uncletall