アプリに 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" に差分を記述。
[taro@fitPC2i cu]$ git push -u origin master error: The requested URL returned error: 401 Unauthorized while accessing https://git.codebreak.com/remix/cu.git/info/refs fatal: HTTP request failedgit が古い模様。
[taro@fitPC2i ~]$ cd ~/web/www/appli/formmail [taro@fitPC2i formmail]$ vi ~/web/www/appli/formmail/README.md [taro@fitPC2i formmail]$ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -a")コミット前の変更ファイルが認識。次は...▼
Create a new repository on the command line touch README.md git init git add README.md git commit -m "first commit" git remote add origin git@github.com:remixgrjp/formmail.git git push -u origin master Push an existing repository from the command line git remote add origin git@github.com:remixgrjp/formmail.git git push -u origin master●その前に、gitconfig 設定...▼
$ ssh-keygen -t rsa -C mymail@domain Generating public/private rsa key pair. Enter file in which to save the key (/home/taro/.ssh/id_rsa): Enter passphrase (empty for no passphrase): ← なし Enter same passphrase again: ← なし Your identification has been saved in /home/taro/.ssh/id_rsa. Your public key has been saved in /home/taro/.ssh/id_rsa.pub. The key fingerprint is: 99:ca:ce:03:cb:4c:74:99:10:4b:fd:33:be:24:c8:99 mymail@domain The key's randomart image is: +--[ RSA 2048]----+ | . . o. | | o . . * E| | + o * o | | . o o + o | | = S o | | + * o . | | = . . | | . | | | +-----------------+ $ ll ~/.ssh total 16 -rw-r--r--. 1 taro apache 162 Jul 4 08:53 config -rw------- 1 taro apache 1675 Jul 3 18:39 id_rsa -rw-r----- 1 taro apache 404 Jul 3 18:39 id_rsa.pub -rw-r--r--. 1 taro apache 2823 Jul 4 08:46 known_hosts●登録する公開鍵文字列
[taro@fitPC2i ~]$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuGuYZe/fw9yuyTZSYqCLKjKGeacAcE5cdSjZg4bdtA9ikPuadyxfvGs/UfJiUye8uTfXufOdF1llBRZSQlMkNNPq+1eet6yigYFuijc/MZ1OsZYPs0fcE9rV7BYYmhpnK89hCmEzs1sd3msM8sh837NhAGkYhwA5pXZaZlOBfcmF7Io12Eeo9tLC+TzrMkLMN6TVAwVPSXI+41qkfTx5/aYc7CLwIUcNubuk5tIh0lpK/6kBAIHD5wWFRWaFAWzc0fMfXk/WTTiPYSKpP4pNHdVS5n1+i/u8HaEVSLdRBQhXEqFDwnD4duHx+wpCNFkQAW68IaJf3ebFN3Ia+muivQ== mymail@domain●自分の github.com/remixgrjp に公開鍵を登録