Open12

GitHub 操作備忘録

marchanmarchan

2024.02.02 Amplify + React をクーロンしてブランチを作成

$ git clone https://github.com/aws-samples/*******.git
  • GitHubリポジトリをローカルマシンにクローン(複製)します。
$ git checkout -b masa
  • 新しいブランチmasaを作成して切り替えます。git branch masaとgit checkout masaを実行と同じ
$ git add .
  • 現在のディレクトリとそのサブディレクトリにある全ての変更をステージングエリアに追加
$ git commit -m "npm install 終了 変更前の状態を保存"
  • ステージングエリアに追加された変更をローカルリポジトリの履歴にコミットします。
$ git remote -v
  • 現在設定されているリモートリポジトリのURLを表示します。
$ git remote set-url origin https://github.com/******/*****.git
  • リモートリポジトリoriginのURLを指定されたURLに変更します。
$ git push -u origin masa
  • ローカルブランチmasaをリモートのoriginリポジトリにプッシュし、originリポジトリのmasaブランチとして設定します。
marchanmarchan

2024.02.03 Cloud9(ap-northeast-1)からAmplify+React 修正

git credential-cache exit
  • Gitの認証情報キャッシュを終了またはクリアします。
git credential exit
  • Gitの認証情報がクリアされ、再認証が必要になります。
git remote -v
  • リモートリポジトリとの接続情報を表示します。
git remote set-url origin https://github.com/***-***/*** ***.git
  • 、指定されたリモートリポジトリ(通常は "origin" )のURLを変更します。
git push -u origin ***
  • Gitリモートリポジトリにコミットをプッシュします。
marchanmarchan

2024.02.05 Amplify+React App.js 修正 動作正常化

git add .
git commit -m "Fix routing issue by wrapping App in HashRouter"

4 files changed, 292 insertions(+), 261 deletions(-)

git branch
  main
* taro
git push origin taro
Username for 'https://github.com/******/***.git': ******
Password for 'https://******@github.com/******/***.git': ******

Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 2 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (12/12), 2.19 KiB | 447.00 KiB/s, done.
Total 12 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (7/7), completed with 7 local objects.

git status

On branch ***
Your branch is up to date with 'origin/***.
nothing to commit, working tree clean

marchanmarchan

2024.02.07 Cloud9(us-east-1)から「***-HTML」をリポジトリに登録

$ cd ******-HTML
$ ls
$ git add .

fatal: not a git repository (or any of the parent directories): .git
※ git addの前にgit init 初期化していなかったためfatalエラー

$ git init
$ git add .
$ git commit -m "Initial commit"

Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
35 files changed, 2660 insertions(+)

$ git remote add orign https://github.com/******/******-HTML
$ git branch -m master main
git push -u origin main
Username for 'https://github.com/***/***-HTML.git': ******
Password for 'https://***@github.com/***/***-HTML.git': ******

Enumerating objects: 54, done.
Counting objects: 100% (54/54), done.
Delta compression using up to 2 threads
Compressing objects: 100% (41/41), done.
Writing objects: 100% (54/54), 22.00 KiB | 1.29 MiB/s, done.
Total 54 (delta 22), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (22/22), done.
To https://github.com//-HTML.git

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

2024.02.07 Cloud9(us-east-1)から「***-Lambda-python」をリポジトリに登録

$ git init

Initialized empty Git repository in /home/ec2-user/environment/*-Lambda-python/.git/

$ git add .
$ git status

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

$ git commit -m "Initial commit"

[main (root-commit) 6f4b495] Initial commit
Committer: EC2 Default User ec2-user@ip-172-30-0-222.ec2.internal
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

18 files changed, 1754 insertions(+)

$ git status

On branch main
nothing to commit, working tree clean

$ git remote add origin https://github.com/***/***-Lambda-python
$ git remote -v

origin https://github.com//-Lambda-python (fetch)
origin https://github.com//-Lambda-python (push)

$ git push -u origin main
Username for 'https://github.com/***/***-Lambda-python': ***
Password for 'https://***@github.com/*/*-Lambda-python': ***

Enumerating objects: 37, done.
Counting objects: 100% (37/37), done.
Delta compression using up to 2 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (37/37), 24.14 KiB | 2.68 MiB/s, done.
Total 37 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), done.
To https://github.com//-Lambda-python

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

2024.02.08 「***-Lambda-python」Modified

$ cd ***-Lambda-python/
$ git remote -v
origin  https://github.com/***/***-Lambda-python (fetch)
origin  https://github.com/***/***-Lambda-python (push)
$ git status

On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ***/lambda_function.py
modified: ***/lambda_function.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
no changes added to commit (use "git add" and/or "git commit -a")

$ git add .
$ git status

On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: ***/lambda_function.py
new file: ***/lambda_function.py
modified: ***/lambda_function.py

$ git commit -m "set OUTPUT-BUCKET"

[main 474779e] set OUTPUT-BUCKET
3 files changed, 104 insertions(+), 5 deletions(-)
create mode 100644 ***/lambda_function.py

$ git status

On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean

$ git commit

On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean

$ git status

On branch main
Your branch is ahead of 'origin/main' by 1 commit.

marchanmarchan

2024.02.09 「***-Lambda-python」Modified

$ git remote -v

origin https://github.com//-Lambda-python (fetch)
origin https://github.com//-Lambda-python (push)

$ git status

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

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ***/lambda_function..py
modified: ***/lambda_function.py
modified: ***/lambda_function.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
SF_Claude/

no changes added to commit (use "git add" and/or "git commit -a")

$ git status

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

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ***/lambda_function..py
modified: ***/lambda_function.py
modified: ***/lambda_function.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
SF_Claude/

no changes added to commit (use "git add" and/or "git commit -a")

$ git add .
$ git status

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

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: ***/lambda_function..py
modified: ***/lambda_function.py
new file: ***/lambda_function.py
modified: ***/lambda_function.py

$ git commit -m "new *** and modified 3file outputbucket tryerror "

[main 177ce25] new ***and modified 3file outputbucket tryerror
4 files changed, 181 insertions(+), 49 deletions(-)
create mode 100644 ***/lambda_function.py

$ git statusOn branch main

Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)

nothing to commit, working tree clean

$ git push
Username for 'https://github.com/***/***-Lambda-python': ******
Password for 'https://***@github.com/***/***-Lambda-python': 

Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 2 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (10/10), 4.00 KiB | 4.00 MiB/s, done.
Total 10 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 3 local objects.
To https://github.com//-Lambda-python
474779e..177ce25 main -> main

$ git status

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

nothing to commit, working tree clean

marchanmarchan

2024.02.13 「***-Lambda-python」Modified

$ git status

On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean

$ git remote -v

origin https://github.com//-Lambda-python (fetch)
origin https://github.com//-Lambda-python (push)

$ git status

On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: SF_Claude/lambda_function.py
no changes added to commit (use "git add" and/or "git commit -a")

$ git add .
$ git status

On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: SF_Claude/lambda_function.py

$ git commit -m

"SF_TranscribeClaude modified"
[main bbb55aa] SF_TranscribeClaude modified
1 file changed, 30 insertions(+), 23 deletions(-)

$ git status

On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean

$ git push
Username for 'https://github.com/***/***-Lambda-python': ***
Password for 'https://***@github.com/***/***-Lambda-python': 

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 755 bytes | 755.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com//-Lambda-python
177ce25..bbb55aa main -> main

$ git status

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

marchanmarchan

2024.02.13 HTML Modified

  • add /AmazonTranscribe_Claude/ index,html
  • modified index.html
cd ***-HTML/
$ git remote -v

origin https://github.com//-HTML (fetch)
origin https://github.com//-HTML (push)

$ git status

On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: index.html
Untracked files:
(use "git add <file>..." to include in what will be committed)
AmazonTranscribe_Claude/

no changes added to commit (use "git add" and/or "git commit -a")

$ git add .
git status

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

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: AmazonTranscribe_Claude/index.html
modified: index.html

$ git commit -m "index.html modified. add 

AmazonTranscribe_Claude."
[main 41cac16] index.html modified. add AmazonTranscribe_Claude.
2 files changed, 51 insertions(+), 6 deletions(-)
create mode 100644 AmazonTranscribe_Claude/index.html

$ git status

On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)

nothing to commit, working tree clean

$ git push
Username for 'https://github.com/***/***-HTML': ***
Password for 'https://***@github.com/***/***-HTML': 

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 2 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.27 KiB | 1.27 MiB/s, done.
Total 5 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com//-HTML
b08f7ad..41cac16 main -> main

$ git status

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

marchanmarchan

2024.02.13 Cloud9で作成したHTMLをS3 にコピー

$ cd ***-HTML/
$ aws s3 cp index.html s3://******-web/index.html
marchanmarchan

2024.02.13 App.js modified

$ git remote -v

origin https://github.com//.git (fetch)
origin https://github.com//.git (push)

$ git status

On branch masa
Your branch is up to date with 'origin/masa'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: src/App.css
modified: src/App.js
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/App_20240213.js

no changes added to commit (use "git add" and/or "git commit -a")

$ git add .
$ git status

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

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: src/App.css
modified: src/App.js
new file: src/App_20240213.js

$ git commit -m "App.js Progress Bar"

[masa 540a9de] App.js Progress Bar

$ git status

On branch masa
Your branch is ahead of 'origin/masa' by 1 commit.
(use "git push" to publish your local commits)

nothing to commit, working tree clean

$ git push
Username for 'https://github.com/***/.git': ***
Password for 'https://***@github.com/***/***.git': 

Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 2 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 2.16 KiB | 2.16 MiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com//.git
158cea0..540a9de masa -> masa

$ git status

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

nothing to commit, working tree clean

marchanmarchan

2024.04.25 Lambda RSS

  • ディレクトリを移動する
$ cd Lambda-RSS/
  • 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>
Initialized empty Git repository in /home/ec2-user/environment/Lambda-RSS/.git/

  • git branch をmaster からmainに変更する
$ git branch -m master main
  • GitHubリポジトリをリモートとして追加する
$ git remote add origin https://github.com/***/Lambda-RSS.git
  • GitHubを確認する
$ git status

On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
SF_TwitterAPI_Post/
nothing added to commit but untracked files present (use "git add" to track)

  • すべてのファイルをステージングエリアに追加する
$ git add .
  • GitHubを確認する
$ git status

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

  • 変更をコミットする
$ git commit -m "Initial Commit"

[main (root-commit) cfb2fc6] Initial Commit
3 files changed, 382 insertions(+)
create mode 100644 Crawling_mvstv.jp/lambda_function.py
create mode 100644 Crawrlng_stvjp_news/lambda_function.py
create mode 100644 SF_TwitterAPI_Post/lambda_function.py

  • 変更をプッシュする(※コマンド実行 失敗)
$ git push

fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin main
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

  • GitHubにプッシュする(失敗後 成功)
$ git push -u origin main
Username for 'https://github.com/***/Lambda-RSS.git': ******
Password for 'https://***@github.com/***/Lambda-RSS.git': *******

Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 2 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (8/8), 5.77 KiB | 2.88 MiB/s, done.
Total 8 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/***/Lambda-RSS.git

  • [new branch] main -> main
    branch 'main' set up to track 'origin/main'.
  • GitHubを確認する
$ git status

On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean