Open1

Cloud9 のプロジェクト(Lambda Python)を GitHub に連携

marchanmarchan

2025.05.05(木)

Cloud9 に作成したプロジェクトディレクトリをGitHub、GitHub https ://github.com/●●●/●●●.git と連携するためのコマンド手順を示す。

Gitの初期化

 $ git init

Initialized empty Git repository in /home/ec2-user/environment/●/.git/

add する

$ git add .
$ git status

On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: /lambda_function.py

commit する

$ git commit -m "Initial commit"

[main (root-commit) 6107061] Initial commit
1 file changed, 112 insertions(+)
create mode 100644 /lambda_function.py

確認する

$ git status

On branch main
nothing to commit, working tree clean

GitHubリポジトリをリモートとして追加する

$ git remote add origin https://github.com/●●●/●●●-Tube.git

※(必要に応じて) mainブランチに名前を変更(今回省略)

$ git branch -M main

Pushする

:~/environment/Lam●-●Tube (main) $ git push -u origin main
Username for 'https://github.com/---/---.git': ●●●
Password for 'https://----@github.com//●●●.git': 

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 1.88 KiB | 1.88 MiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0

  • [new branch] main -> main
    branch 'main' set up to track 'origin/main'.

確認する

$ git status

On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean