コンテンツにスキップ

a-Shell git

a-Shellでgitコマンドを使用する方法

参考記事

a-Shellアプリでgitコマンドを使用する方法

はじめに

a-Shellアプリではデフォルトでgitコマンドをサポートしていませんが、個別にgitコマンド1をインストールすることで使用できます。

1
2
$ git version
libgit2 version 1.1.0

インストール方法

pkgコマンドでインストールします。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[~Documents]$ pkg install git
Downloading git
The git command cannot be included with
a-Shell. Would you like to create a
script at $HOME/Documents/bin/git that
wraps lg2 with the following contents?
#!/bin/sh
lg2 "$@"
Keep in mind that git and lg2 options
are not 100% compatible, and they also
do not use the same configuration files
or environment variables.
Create $HOME/Documents/bin/git? (y/n [n]) y
Creating $HOME/Documents/bin/git
Creation complete
Done

指定可能なgitコマンドのオプションについて

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[~Documents]$ git help
usage: lg2 <cmd>...

Available commands:

        add
        apply
        rm
        blame
        branch
        cat-file
        checkout
        clone
        commit
        config
        describe
        diff
        fetch
        for-each-ref
        index-pack
        init
        log
        ls-files
        ls-remote
        merge
        push
        pull
        rebase
        remote
        reset
        rev-list
        rev-parse
        show-index
        self-test
        stash
        status
        submodule
        tag
        version
        help

リポジトリの取得

publicリポジトリであれば、git cloneコマンドでクローンできますが、privateリポジトリの場合はPATによる認証が必要になります。

privateリポジトリをクローンする場合は、passwordと表示されるため、そこに、入力、または、フォーカスされた状態で画面を長押ししてコピーしたパスワードをペーストすることでクローンできます。

ペーストボタンだとなぜが貼り付けられなかったので、この方法でしかできませんでした。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[~Documents]$ git clone リポジトリ.git
Cloning into ./リポジトリ.git
Password:
remote: Enumerating objects: 146, done. remote: Counting objects: 100% (146/146), done. remote: Compressing objects: 100% (121/121), done.
net 0% ( 15 kb, 0/ 146) / idx 0% ( 0/
net 0% ( 15 kb, 1/ 146) / idx 0% ( 1/
...
net 99% (5930 kb, 145/ 146) / idx 92% ( 135/
remote: Total 146 (delta 10), reused 142 (delta 10), pack-reused 0 (from 0)
Resolving deltas 10/10

  1. gitコマンドはオリジナルのgitではなく、libgit2のver1.1.0を使用してgitコマンドを実行しているようです。また、a-Shellが公式のlibgit2を使用しているかまでは未確認ですが、2025/01/11時点ではlibgit2のlatestはver1.9.0でした。