メイン

Git アーカイブ

2022年10月01日

アプリに git リビジョン情報を埋め込む

 gitのコミット情報、例えば
git log -1 --date=iso --format='%cd,%h'
のように整形したコミット情報
2022-10-01 00:00:55 +0900,9bcf00b
を WEB や android アプリに 現在のバージョン情報として埋め込む方法例。...▼

続きを読む "アプリに git リビジョン情報を埋め込む" »

2021年11月13日

HTTPプロトコルGit公開リポジトリ

git version 2.27.0

 2つのHTTPプロトコル(Smart HTTP, Dumb HTTP)のうち、古くからの Dumb HTTP での リードオンリーGit公開リポジトリの作り方備忘録。
●対象ローカルリポジトリ(WORKING1)からマスターリポジトリ(REPOSITORY1.git)を作成。
$ 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
でクローンが可能。

 本家のドキュメント
4.1 Gitサーバー - プロトコル
10.6 Gitの内側 - 転送プロトコル

2021年11月12日

yum で CentOS6~ に Git2~をインストール。

前提環境 CentOS 6.6, 64bit

 CentOS6~の終了でリポジトリ情報
/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。具体的には...▼

続きを読む "yum で CentOS6~ に Git2~をインストール。" »

2020年12月13日

FTPのみのレンタルサーバーをGitで更新したい

 ワードプレスで満足というかワードプレスでしかWEBコンテンツ作れない人が好んで選択する格安レンタルサーバ。 まもなく限界となりWEBアプリケーション構築となった時、ssh接続できない、Git管理できない。

 何百何千ものファイルをFTP管理しているつもりになって不要ファイルの肥溜めサーバーとなるのは火を見るより明らか・・・。 FTPでしかコンテンツを管理できないのを何とかできないか・・・ GitがFTPプロトコルをしゃべってくれれば良いものの今更FTPなのかクローンとフェッチのみ。

 調べてみると、git-サブコマンド(git-subcommand)を応用した "git-ftp" ツールが見つかります。さすが Git コマンドは奥が深い。
 前提 git-ftp version 1.6.0 早速 導入・・・▼

続きを読む "FTPのみのレンタルサーバーをGitで更新したい" »

2020年10月11日

CentOS6 での Git2.*

 2017年ごろ CentOS6.9 サーバへインストールしたGit。
$ 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 コマンドでインストールできない?
https://repo.ius.io/6/x86_64/repodata/repomd.xml
は、存在しているのだけど・・・。

続きを読む "CentOS6 での Git2.*" »

2018年06月30日

フックでプル&バックアップを自動化

 前回の構成「サーバー上のGitでWEBコンテンツリリース」で、(A/4)へのリリースや(B/3)へのバックアップを手動から自動にするには。
(A)で
$ sudo vi /opt/git/◆◆◆.git/hooks/post-receive
(B)からの push で、自動で(A)の★★★へリリース(pull)する場合
#!/bin/sh
git --git-dir=★★★/.git pull origin master
ただし、push 出来る人には制限が必要。
(A)のベアリポジトリ(1)/opt/git/◆◆◆.git への更新タイミングで(B/3)を自動更新(バックアップ)にする場合
#!/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

続きを読む "フックでプル&バックアップを自動化" »

サーバー上のGitでWEBコンテンツリリース

(A)WEBサーバ   (B)開発/検証/バックアップ機
(1) /opt/git/◆◆◆.git      
(2) ★★★
  <<-----ssh
ssh----->>
 
(3) △△△◆◆◆.git
(4) ★★★
   

続きを読む "サーバー上のGitでWEBコンテンツリリース" »

2016年04月04日

.gitignore 備忘録

設定情報やログなど ドキュメントルートのあちこちに配置してしまっている web のリソース。
『過去と他人は変えられないが未来と自分は変えられる』訳で Git の ".gitignore" を駆使。
# UTF8で除外設定 .gitignore

# カレントのみ AAAディレクトリ
/AAA/

# カレントのみ BBBファイル
/BBB

# カレント以下全階層 Smartyコンパイルディレクトリ
templates_c/

# カレント以下全階層 Appleゴミファイル
.DS_Store
# カレント以下全階層 Windowsゴミファイル
Thumbs.db
# カレント以下全階層 末尾が".CCC"ファイル
*.CCC
特定ディレクトリ内の除外設定は、特定ディレクトリ内の ".gitignore" に差分を記述。

2013年07月06日

ギットブレイクに新規リポジトリ登録

ギットブレイクでアカウントを登録したら、Git リポジトリ一覧ページで、新規リポジトリを追加。

前提環境・バージョン
CentOS release 6.4 (Final)

git version 1.8.3.2

github と異なり公開鍵の設定がなく、ID・パスワードで接続...▼

続きを読む "ギットブレイクに新規リポジトリ登録" »

2013年07月05日

git アップフレード 1.7.1 → 1.8.3.2

パブリックの他、プライベートも無料のギットブレイクに、アプリケーションの新規リポジトリ登録。
[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 failed
git が古い模様。
前提環境・バージョン
CentOS release 6.4 (Final)

git version 1.7.1

現時点で yum コマンドでは アップグレードされない為、git を手動アップグレード。...▼

続きを読む "git アップフレード 1.7.1 → 1.8.3.2" »

2013年07月04日

GitHub で、アプリケーションを公開 No.4

●README.md を編集
[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")
コミット前の変更ファイルが認識。次は...▼

続きを読む "GitHub で、アプリケーションを公開 No.4" »

2013年07月03日

GitHub で、アプリケーションを公開 No.3

ベクターに無料公開中の ethna アプリケーション formmail を Github に公開。

●新規リポジトリを作成。
https://github.com/new
ローカルのアプリケーションは formmail ディレクトリ配下
https://github.com/remixgrjp/formmail

●Github で新しくリポジトリを作ると https://github.com/remixgrjp/formmail に公開手順が示される
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 設定...▼

続きを読む "GitHub で、アプリケーションを公開 No.3" »

2013年07月02日

GitHub で、アプリケーションを公開 No.2

GitHub には ssh を使って接続するので、ローカル クライアントで 鍵を生成し、公開鍵を GitHub に登録。

●秘密鍵・公開鍵の生成
$ 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 に公開鍵を登録
Account settings(マイページ右上)
https://github.com/settings/profile

SSH Keys

Add SSH Key
key へ公開鍵文字列をコピーして「Add key」

●登録された公開鍵の確認URL...▼

続きを読む "GitHub で、アプリケーションを公開 No.2" »

2013年07月01日

GitHub で、アプリケーションを公開 No.1

ドキュメントの履歴を管理する Git を、Web上で実現する GitHub。

http://github.com/
非公開でなければ無料。

Sign up for GitHub
https://github.com/signup/free

Username : remixgrjp
Email Address は公開される。
https://github.com/remixgrjp

前提環境、バージョンは...▼

続きを読む "GitHub で、アプリケーションを公開 No.1" »

About Git

ブログ「Remix.asia」のカテゴリ「Git」に投稿されたすべてのエントリーのアーカイブのページです。過去のものから新しいものへ順番に並んでいます。

前のカテゴリはethnaです。

次のカテゴリはjavaです。

他にも多くのエントリーがあります。メインページアーカイブページも見てください。