0
0

More than 1 year has passed since last update.

PCを更新したらUbuntu+Apache+Gitの設定に悩んだ

Posted at

Webサイトのデータ管理をノートPC+Ubuntu+Apache+Gitで行っています。
代々バージョンアップを重ねてきた旧PCが動作緩慢になったため、新PCにUbuntu 22.04のクリーンインストールを行い、旧PCの設定を移植しました。
ところが、git pushができません。Apacheのログを確認すると、権限で跳ねられています。新旧PCとも同じOS、同じ設定なのに…。

"GET /#{gitリポジトリ}/info/refs?service=git-receive-pack HTTP/1.1" 403

あれも効果なしこれも効果なしと悩むこと数時間。Apacheの設定に「SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER」を追加したら解決しました。

<VirtualHost *:80>
   SetEnv GIT_PROJECT_ROOT /srv/git
   SetEnv GIT_HTTP_EXPORT_ALL
   SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER #この行を追加したら動作した!
   ScriptAlias /git /usr/lib/git-core/git-http-backend/

   <Directory "/usr/lib/git-core">
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       AllowOverride None
       Require all granted
   </Directory>
</VirtualHost>

同じバージョンのOSでもバージョンアップの経緯により動作が変わるなんてことがあるんですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0