LoginSignup
0
0

More than 1 year has passed since last update.

備忘録 CodeCommit

Last updated at Posted at 2023-03-23

【復習】Git(initからpushまで)
Gtiの復習をしたので今度は去年の12月に取得したAWS-DVAの復習も兼ねてAWS Skill Builder、CodeCommit入門のハンズオンをやってみました。自分用なのでまとめ方だいぶテキトーです。

リモートリポジトリ作成〜pushまで

①CodeCommitのコンソールにてリポジトリ名を入力し、作成を押下、リポジトリのURLを控える
②IAMのコンソールにてユーザを新規作成、AWSCodeCommitPowerUserを付与
③作成したユーザ>セキュリティ認証情報AWS CodeCommit の HTTPS Git 認証情報にて認証情報を発行する
④ローカルの作業フォルダにてinit,cloneを実行
warning:〜はファイルがない。空だよって教えてくれてる

$ git init
$ git clone [リポジトリ作成時に控えたURL]
Cloning into 'test-repository'...
git: 'credential-aws' is not a git command. See 'git --help'.
Username for 'https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/test-repository': [認証情報:ユーザ名を入力]
Password for 'https://commit_testuser+1-at-272958834483@git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/test-repository': [認証情報:パスワード]
git: 'credential-aws' is not a git command. See 'git --help'.
warning: You appear to have cloned an empty repository.

⑤適当にファイルを作ってpushまで実行

$ vi "newFile"
$ git add .
$ git commit -m "first"
[master (root-commit) 0d5d8b9] first
 1 file changed, 3 insertions(+)
 create mode 100644 newFile
$ git push origin master
git: 'credential-aws' is not a git command. See 'git --help'.
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 215 bytes | 215.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Validating objects: 100%
To https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/test-repository
 * [new branch]      master -> master

⑥CodeCommitのコンソールを確認しリモートリポジトリにpushされていることを確認する
Screenshot (4).png

branch checkout merge など

前回のgit復習でできなかったことをやりました。

参考
Git のブランチ機能 - ブランチとマージの基本

# ブランチの切り替え
$ git checkout branch2
Switched to branch 'branch2'

# ブランチを作成、切り替え
$ git checkout -b branch2
Switched to a new branch 'branch2'

# ブランチの確認
$ git branch
* branch1  branch2  master

# マージ先のブランチに切り替えてからマージ
$ git checkout master
$ git merge branch2
Updating 0d5d8b9..ad4b2e1
Fast-forward
 bbb | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 bbb
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0