ラベル git の投稿を表示しています。 すべての投稿を表示
ラベル git の投稿を表示しています。 すべての投稿を表示

2016/04/06

git 2.0.0 → git 2.8.1

% git --version
git version 2.0.0
% cd /opt/src % wget https://www.kernel.org/pub/software/scm/git/git-2.8.1.tar.gz % tar xf git-2.8.1.tar.gz % cd git-2.8.1 % ./configure --prefix=/opt/git/git-2.8.1 --with-openssl --with-curl % make % make install % /opt/git/git-2.8.1/bin/git --version
git version 2.8.1
% ln -sfn /opt/git/git-2.8.1/bin/* /usr/bin % git --version
git version 2.8.1
とくに問題なし、前回と同じ。

2014/06/06

git-2.0.0をサーバにインストール

% cd /opt/src
% wget https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz
% tar xf git-2.0.0.tar.gz
% cd git-2.0.0
% ./configure --prefix=/opt/git/git-2.0.0 --with-openssl --with-curl
% make
% make install
% /opt/git/git-2.0.0/bin/git --version
git version 2.0.0
% ln -sfn /opt/git/git-2.0.0/bin/* /usr/bin % git --version
git version 2.0.0
ln -sfnでシンボリックリンクが上書きできることを初めて知ったのでメモ。

2014/05/16

git1.9.3をインストール

バージョン1.7はさすがに古いなと思ったので、さくらVPSのUbuntu12.04にgitの最新版をインストールした。
% wget https://www.kernel.org/pub/software/scm/git/git-1.9.3.tar.gz
早速エラー。https対応をしていなかった。
% echo 'ca-certificate = /etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc
% wget https://www.kernel.org/pub/software/scm/git/git-1.9.3.tar.gz
% ./configure --prefix=/opt/git/git-1.9.3 --with-openssl --with-curl
% make
/bin/sh: 1: msgfmt: not found
とエラーになった。どうやらgettextが必要らしい。
% aptitude install gettext
% make
% make install
% /opt/git/git-1.9.3/bin/git --version
git version 1.9.3
インストールが成功したので、既存と置き換える。
% aptitude remove git-core
% ln -s /opt/git/git-1.9.3/bin/* /usr/bin
% git --version
git version 1.9.3
お疲れ様でした。

2013/07/08

github のリポジトリを remote add して push したらエラーが出た

git push したらこんなエラーが出た。

% git push origin master
To git@github.com:pinzolo/repo.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:pinzolo/repo.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

いつも下記の手順で github と連携していたから、特に困ったことはなかった。

  1. github にリポジトリを作成する
  2. ローカルに clone する
  3. 開発する

しかし今回は

  1. ローカルで git init する
  2. github リポジトリを作成
  3. ローカルに対して git add origin git@github.com:pinzolo/repo.git
  4. 冒頭のエラー

というわけだ。

github でリポジトリを作成した時に README.md を作成したから、そっちの情報がなかったわけね。
というわけで、一旦 git pull してから git push したらエラーは出なくなった。なるほど

2012/12/07

git config --global push.default simple したら neobundle.vim でエラーになった

git push したらwarningがでた

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

そういえば git の push.default を設定していなかったので、simpleに設定しておいた。

git config --global push.default simple

vimを起動したらwarningがでた

This is old version of neocomplcache-snippets-complete.
This is no longer maintained.
You should use neosnippet plugin instead of it.
https://github.com/Shougo/neosnippet

neocomplcache-snippets-complete は古いから neosnippet 使えよということらしい。
.vimrc から

NeoBundle 'Shougo/neocomplcache-snippet-complete'

を削除して

NeoBundle 'Shougo/neosnippet'

に変更して:NeoBundleInstallを実行した。

エラーになった

/Users/pinzolo/.vim/bundle/neosnippet
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 22 in /Users/pinzolo/.gitconfig
Cloning into /Users/pinzolo/.vim/bundle/neosnippet...

simple は push.default の値として不正だからnothing, matching, tracking, currentのどれかにしろと。
普通にgit pullするのは問題ないのになぁ。

simple から currentへ

git config --global push.default current

にして、:NeoBundleInstallしたら成功した。
挙動としては simple の方が好きなんだけど、とりあえず current にしておくか。
neobundle側での原因と対策も調べないとな。

2012/06/09

さくら VPS の Ubuntu Server 10.04 に git サーバーを構築

公開リポジトリは github でいいけれど、プライベートなリポジトリも欲しいよね。
というわけで、サーバーに git のリポジトリをたてるべく gitosis をさくらの VPS の Ubuntu Server 10.04 に導入したのでメモ。

# gitosis のインストール
pinzolo@server:~$ sudo aptitude install -y gitosis
[sudo] password for pinzolo: Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done The following NEW packages will be installed: gitosis python-pkg-resources{a} python-setuptools{a} 0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 318kB of archives. After unpacking 1,487kB will be used. Writing extended state information... Done Get:1 http://jp.archive.ubuntu.com/ubuntu/ lucid/main python-pkg-resources 0.6.10-4ubuntu1 [65.0kB] Get:2 http://jp.archive.ubuntu.com/ubuntu/ lucid/main python-setuptools 0.6.10-4ubuntu1 [213kB] Get:3 http://jp.archive.ubuntu.com/ubuntu/ lucid/universe gitosis 0.2+20090917-2 [40.4kB] Fetched 318kB in 0s (501kB/s) Preconfiguring packages ... Selecting previously deselected package python-pkg-resources. (Reading database ... 64406 files and directories currently installed.) Unpacking python-pkg-resources (from .../python-pkg-resources_0.6.10-4ubuntu1_all.deb) ... Selecting previously deselected package python-setuptools. Unpacking python-setuptools (from .../python-setuptools_0.6.10-4ubuntu1_all.deb) ... Selecting previously deselected package gitosis. Unpacking gitosis (from .../gitosis_0.2+20090917-2_all.deb) ... Setting up python-pkg-resources (0.6.10-4ubuntu1) ... Processing triggers for python-central ... Setting up python-setuptools (0.6.10-4ubuntu1) ... Processing triggers for python-central ... Setting up gitosis (0.2+20090917-2) ... Please read /usr/share/doc/gitosis/README.Debian for information about how to use gitosis. Processing triggers for python-support ... Reading package lists... Done Building dependency tree Reading state information... Done Reading extended state information Initializing package states... Done Writing extended state information... Done
# git ユーザーを作成 pinzolo@server:~$ sudo adduser git --system --shell /bin/sh --group --disabled-password --home /var/lib/git
Adding system user 'git' (UID 107) ... Adding new group 'git' (GID 116) ... Adding new user 'git' (UID 107) with group 'git' ... Creating home directory '/var/lib/git' ...
# gitosis 初期化 pinzolo@server:~$ sudo -H -u git gitosis-init < .ssh/id_rsa.pub
Initialized empty Git repository in /var/lib/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /var/lib/git/repositories/gitosis-admin.git/
# post-update フックスクリプトに実行権限を付与 pinzolo@server:~$ sudo chmod 755 /var/lib/git/repositories/gitosis-admin.git/hooks/post-update
これでサーバー上の作業はおしまい。

ここからローカルでの作業。

# 管理リポジトリを clone する
pinzolo@local % git clone git@server:gitosis-admin.git
Cloning into 'gitosis-admin'... remote: Counting objects: 5, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 0), reused 5 (delta 0) Receiving objects: 100% (5/5), done.
# リポジトリ内はこんな構造になっている pinzolo@local % cd gitosis-admin pinzolo@local % tree
. ├── gitosis.conf └── keydir └── pinzolo@mkt-sys.jp.pub 1 directory, 2 files
# gitosis.conf を編集 pinzolo@local % vim gitosis.conf
[gitosis] [group gitosis-admin] writable = gitosis-admin members = pinzolo@mkt-sys.jp # ここから追加 [group hoge] writable = hoge members = pinzolo@mkt-sys.jp
# 修正を commit して、反映させるために push(新しいリポジトリ hoge.git が作成される) pinzolo@local % git add gitosis.conf pinzolo@local % git status
# On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: gitosis.conf #
pinzolo@local % git commit -m "hogeリポジトリを追加"
[master 01e4aec] hogeリポジトリを追加 1 file changed, 4 insertions(+)
pinzolo@local % git push
Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 387 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To git@server:gitosis-admin.git 893246e..01e4aec master -> master
# サーバーのリポジトリを origin として登録し push する pinzolo@local % cd ~/projects/hoge pinzolo@local % git remote add origin git@server:hoge.git pinzolo@local % git push origin master
Counting objects: 5557, done. Delta compression using up to 2 threads. Compressing objects: 100% (5162/5162), done. Writing objects: 100% (5557/5557), 14.71 MiB | 145 KiB/s, done. Total 5557 (delta 1436), reused 0 (delta 0) To git@server:hoge.git * [new branch] master -> master

結構簡単に中央リポジトリのある開発ができますね。

さくら VPS (Ubuntu Server 10.04)設定エントリ一覧