git操作 含む、codecommit


Aws codecommit


コマンドライン上からの利用 参考

(バージョン確認)

$ aws –version

aws-cli/1.18.147 Python/2.7.18 Linux/5.10.75-79.358.amzn2.x86_64 botocore/1.18.6

(awsコマンドの環境設定)

$ aws configure

AWS Access Key ID [None]: AKIA********************

AWS Secret Access Key [None]: ***************************************

Default region name [None]: ap-northeast-1

Default output format [None]: json

(リポジトリ一覧の取得)

$ aws codecommit list-repositories

{

“repositories”: [

{

“repositoryName”: “10780”,

“repositoryId”: “e8c8acc3-9***************-3d327f8c50bb”

},

{

“repositoryName”: “16040-backend”,

“repositoryId”: “c4f1b3cb-***************-082b2ea806de”

},

{

“repositoryName”: “16040-frontend”,

“repositoryId”: “e3dc6cd9-**************-51eaebf064d5”

},

{

“repositoryName”: “16060”,

“repositoryId”: “de2f1eb0-6f54-4f90-83f7-4989a7601e41”

},

(単一の CodeCommit リポジトリの詳細を表示するには)

$ aws codecommit get-repository –repository-name 16060

{

“repositoryMetadata”: {

“creationDate”: 1641444030.875,

“defaultBranch”: “main”,

“repositoryName”: “16060”,

“cloneUrlSsh”: “ssh://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/16060”,

“lastModifiedDate”: 1641444200.545,

“repositoryDescription”: “Re:Dash 仕様\nクライアント Ver12利用”,

“cloneUrlHttp”: “https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/16060”,

“repositoryId”: “de2f1eb0-**************-4989a7601e41”,

“Arn”: “arn:aws:codecommit:ap-northeast-1:585652132776:16060”,

“accountId”: “585652132776”

}

}

 

AWS CodeCommit リポジトリで Git オペレーションを実行するには 参考

(gitをインストール)

$ yum install -y git

(EC2 インスタンスで認証情報ヘルパーをセットアップする)

$ git config –global credential.helper ‘!aws codecommit credential-helper $@’

$ git config –global credential.UseHttpPath true

(名前と電子メールアドレス、デフォルトブランチ名を明示的に設定する)

$ git config –global user.email “herohero****@*********”

$ git config –global user.name “herohero**** From ReDash(AWS)”

$ git config –global init.defaultBranch main

(AWS-CodeCommitから、git clone でコピーする)

$ git clone https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/16060

Cloning into ‘16060’…

remote: Counting objects: 3, done.

Unpacking objects: 100% (3/3), 812 bytes | 812.00 KiB/s, done.

$ ls 16060 -la

合計 4

drwxrwxr-x 3 ec2-user ec2-user   36  1月  6 05:07 .

drwx—— 6 ec2-user ec2-user  152  1月  6 05:07 ..

drwxrwxr-x 8 ec2-user ec2-user  163  1月  6 05:07 .git

-rw-rw-r– 1 ec2-user ec2-user 1794  1月  6 05:07 Dockerfile

Git操作

(ローカルリポジトリの状態)

$ cd 16060

[ec2-user@ip-172-**-***-98 16060]$ git status

On branch main

Your branch is up to date with ‘origin/main’.

nothing to commit, working tree clean

(リビジョンを確認)

[ec2-user@ip-172-**-***-98 16060]$ git log

commit 3079647da615bba5b26f39fa98d07917badb3136 (HEAD -> main, origin/main, origin/HEAD)

Author: herohero**** <herohero****@*******.jp>

Date:   Thu Jan 6 04:43:18 2022 +0000

当初、ローカルサーバーで実行時のDockerfile内容

オラクルクライアントを手動で設置している。

(「README.md」を編集)

(インデックスに追加)

[ec2-user@ip-172-30-250-98 16060]$ git add README.md

(ローカルリポジトリに保存(commit))

[ec2-user@ip-172-30-250-98 16060]$ git commit -m “Add README.md 追加”

[main f652262] Add README.md 追加

1 file changed, 8 insertions(+)

create mode 100644 README.md

(再度、リビジョンを確認)

[ec2-user@ip-172-30-250-98 16060]$ git log

commit f65226263f57316fa5a026b99833b62c1d64cb49 (HEAD -> main)

Author: herohero**** From ReDash(AWS) <herohero****@********.jp>

Date:   Thu Jan 6 05:49:03 2022 +0000

Add README.md 追加

commit 3079647da615bba5b26f39fa98d07917badb3136 (origin/main, origin/HEAD)

Author: herohero**** From ReDash(AWS) <herohero****@********.jp>

Date:   Thu Jan 6 04:43:18 2022 +0000

当初、ローカルサーバーで実行時のDockerfile内容

オラクルクライアントを手動で設置している。

(リモートリポジトリに登録)

[ec2-user@ip-172-**-***-98 16060]$ git push -u origin main

Enumerating objects: 4, done.

Counting objects: 100% (4/4), done.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 462 bytes | 462.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

To https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/16060

3079647..f652262  main -> main

Branch ‘main’ set up to track remote branch ‘main’ from ‘origin’.

(状態確認)

[ec2-user@ip-172-**-***-98 16060]$ git status

On branch main

Your branch is up to date with ‘origin/main’.

nothing to commit, working tree clean

git status
git add src
git commit -m “PHP7,PHP5&CodeIgnaiter2.0.1追加”
git push -u origin master

タイトルとURLをコピーしました