アプリに git リビジョン情報を埋め込む
git log -1 --date=iso --format='%cd,%h'のように整形したコミット情報
2022-10-01 00:00:55 +0900,9bcf00bを WEB や android アプリに 現在のバージョン情報として埋め込む方法例。...▼
git log -1 --date=iso --format='%cd,%h'のように整形したコミット情報
2022-10-01 00:00:55 +0900,9bcf00bを WEB や android アプリに 現在のバージョン情報として埋め込む方法例。...▼
$ git clone --bare WORKING1 REPOSITORY1.git●ここからが公開リポジトリに必要な処理。
$ touch REPOSITORY1.git/git-daemon-export-ok $ git -C REPOSITORY1.git --bare update-server-info $ mv REPOSITORY1.git/hooks/post-update.sample REPOSITORY1.git/hooks/post-update●最後にWebのドキュメントルート(例 /var/www/html)の(例 dat/blog/git)へ配置。
$ mv REPOSITORY1.git /var/www/html/dat/blog/git/REPOSITORY1.gitこの場合 公開アドレスは
http://remix.asia/dat/blog/git/REPOSITORY1.gitとなり、制限しなければだれでも
$ git clone http://remix.asia/dat/blog/git/REPOSITORY1.git WORKING2でクローンが可能。
/etc/yum.repos.d/CentOS-Base.repoの
http://mirrorlist.centos.orgを
http://vault.centos.orgに代替して久しく、未だにCentOS6環境。現在 yum コマンドを使用すると http から https へリダイレクトされ次のエラー。
https://vault.centos.org/6.10/%2A/x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connectionもはやCentOS6~では接続できない。http で接続できる
http://ftp.riken.jp/Linux/centos-vault/ http://ftp.jaist.ac.jp/pub/Linux/CentOS-vault/ http://ftp.iij.ad.jp/pub/linux/centos-vault/等への代替で ok。具体的には...▼
$ wget http://wing-repo.net/wing/6/EL6.wing.repo $ sudo mv EL6.wing.repo /etc/yum.repos.d/. $ sudo yum -y --enablerepo=wing install git $ git --version git version 2.3.7その後 2018年ごろから リポジトリー wing がなくなり ius に。
$ sudo yum install https://repo.ius.io/ius-release-el6.rpm $ sudo yum install git2uところが、本日現在
https://repo.ius.io/6/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" 他のミラーを試します。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. エラー: Cannot retrieve repository metadata (repomd.xml) for repository: ius. Please verify its path and try againもはや yum コマンドでインストールできない?
$ sudo vi /opt/git/◆◆◆.git/hooks/post-receive(B)からの push で、自動で(A)の★★★へリリース(pull)する場合
#!/bin/sh git --git-dir=★★★/.git pull origin masterただし、push 出来る人には制限が必要。
#!/bin/sh git --git-dir=/opt/git/◆◆◆.git push --mirror USER@HOST:/opt/git/◆◆◆.gitのように post-receive を作成し、実行権限をつけて完成。
$ sudo chown admin:wheel /opt/git/◆◆◆.git/hooks/post-receive $ sudo chmod +x /opt/git/◆◆◆.git/hooks/post-receive
(A)WEBサーバ | (B)開発/検証/バックアップ機 | |||||
---|---|---|---|---|---|---|
(1) | /opt/git/◆◆◆.git | |||||
(2) | ★★★ | |||||
<<-----ssh ssh----->> |
||||||
(3) | △△△◆◆◆.git | |||||
(4) | ★★★ | |||||
# UTF8で除外設定 .gitignore # カレントのみ AAAディレクトリ /AAA/ # カレントのみ BBBファイル /BBB # カレント以下全階層 Smartyコンパイルディレクトリ templates_c/ # カレント以下全階層 Appleゴミファイル .DS_Store # カレント以下全階層 Windowsゴミファイル Thumbs.db # カレント以下全階層 末尾が".CCC"ファイル *.CCC特定ディレクトリ内の除外設定は、特定ディレクトリ内の ".gitignore" に差分を記述。