VSCodeとCode for IBMi(IFS上のgitコマンドを使う)
担当 : 宮原 直大
本記事ではVSCodeとCode for IBMi(IFS上のgitコマンドを使う)について整理します。
VSCodeにCode for IBMiプラグインをインストールし、IBMiへの接続設定をします
■IBMi接続時に表示される画面
IFS BrowserでIFSのファイルを選んで開くことで編集が可能
■コンパイル手順
IFSブラウザ-ソースファイルで右クリック-Run Action-CRTBNDRPG でVSCode上でコンパイルが可能
以下成功時:コンパイル成功時は「* was successfull」と表示される
以下失敗時:失敗時は「* was not successfull」と表示される
■VSCode+Code for IBMiでIFS上のファイルをgit管理するには、ターミナル画面でsshしてgitコマンドで操作方法
◯既存のディレクトリをレポジトリに初期化する場合
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
*これで initial/.git ディレクトリが作成される場合
◯既存のレポジトリをディレクトリにダウンロードする=git initしない
$ git clone http://54.238.144.122/practice/(レポジトリ名).git
Cloning into 'takami'...
Username for 'http://54.238.144.122': {gitlabの自分のアカウント名}
Password for 'http://takami@54.238.144.122': {gitlabの自分のパスワード}
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (4/4), done.
◯git操作に必要な情報を登録する
*自分の名前とメールにします
$ git config --local user.name "Y.Takami"
$ git config --local user.email "takami@emboma.jp"
*これで initial/.git/configに[user]セクションが追加される
◯ソース編集後gitサーバにpushする
$ git add .
$ git commit -m "Initial commit"
[master (root-commit) d220f49] Initial commit
2 files changed, 17 insertions(+)
create mode 100644 HLO_TKM.rpgle
create mode 100644 README
*全ファイルをgit commitする(まだgitlabは更新されていない)
$ git push origin master
Username for 'http://54.238.144.122': {gitlabの自分のアカウント名}
Password for 'http://takami@54.238.144.122': {gitlabの自分のパスワード}
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 32 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 472 bytes | 157.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To http://54.238.144.122/practice/takami.git
* [new branch] master -> master
*これでgitlabにpushされた。Webで更新されたことを確認する
当記事の著作権はIBMに帰属します。
詳細はこちらを参照ください。