GitpYthonを使用してブランチの変更をgerritにプッシュしたい場所に次のコードがあります。Gitpythonを使用してrefs/for/masterとchange-idの問題をプッシュ
repo_path_new = repo_path+repo_name
repo_obj = Repo(repo_path_new)
os.chdir(repo_path_new)
repo_obj.git.add(A=True)
if commit_command_line(commit_message, repo_obj, repo_name):
repo_obj.git.push("origin", "HEAD:refs/for/master")
それは追加し、コミットするファイル(複数可)が、私はのために/マスター/レフリーにプッシュしたいとき、私は問題を得る:
remote: Processing changes: refs: 1, done
remote: ERROR: [0f7c907] missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P port
[email protected]:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote: git commit --amend
remote:
To ssh://url:port/repo-name
! [remote rejected] HEAD -> refs/for/master ([0f7c907] missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://url:port/repo-name''
は、私がクローンに立っていますのでご注意ください。レポもちろん、git bashに手動でgit hook change-idをインストールすることができます。しかし、これは自動的に行われることになっているので、gitpythonでそれを行う方法があるかどうかを知りたいです。
手動でリポジトリをクローンしました。私はあなたがそれが動作すると言っている方法をインストールするが、このスクリプトは(ちょうどジェンキンスのように)Goのcdで実行されるので、コミットmsgフックが存在することを伝える方法がありません。私のコードでは、あなたが私に与えた最初のオプションを呼び出し、gitdir(見つからない)で失敗します。 – user535081
リポジトリをクローンした直後でgitpythonスクリプトを実行する前に、go-cdを設定してbashスクリプト(commit-msgフックをインストールするコマンド)を実行できますか? –