Git BASH 作業履歴 2022/10/21 / P28 site-ranking(4Th-Ranking-Service) / 他の「.git」ディレクトリが存在した状態のまま下記gitコマンドを実行したため、意図せず「submodule」化されてしまった例

GitGit BASH

目次一覧

 状態:-  閲覧数:338  投稿日:2022-10-21  更新日:2022-10-21
プロジェクト新規作成 / プロジェクト追加作成

プロジェクト新規作成 / プロジェクト追加作成

 閲覧数:87 投稿日:2022-10-21 更新日:2022-10-21

プロジェクト新規作成


1
(main)
$ cd /L/1_Hp/0_sakura/2018server/var/www/html/p-28

2
$ git init
Initialized empty Git repository in L:/1_Hp/0_sakura/2018server/var/www/html/p-28/.git/


3
順調なのは、ここまでだった。
(main)
$ git remote add origin git@github.com:GitHubユーザー名/P28-4th-Ranking-Service.git

迷1
他の「.git」ディレクトリが存在した状態のまま下記gitコマンドを実行したため、意図せず「submodule」化されてしまう
(main)
$ git add -A
warning: adding embedded git repository: △△
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> △△
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached △△
hint:
hint: See "git help submodule" for more information.


迷2
ここで、「.git」ディレクトリを手動削除後、再度下記コマンドを実行したが、多分この処理が誤り。
(未確認だけれども恐らく)既に「submodule」化されているのだから、後で実行している「$ git rm -rf --cached △△」を「$ git add -A」の前に実行した方が良かったと思われ。
(main)
$ git add -A

(main)
$ git commit -m "first commit"
[main (root-commit) b626c3b] first commit
119 files changed, 33294 insertions(+)
create mode 100644 0webapp/LICENSE
create mode 100644 0webapp/MiniBlogApplication.php


「$ git fetch」不要かと思ったが、必要みたい。
(main)
$ git merge --allow-unrelated-histories origin/main
merge: origin/main - not something we can merge

(main)
$ git fetch
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 637 bytes | 6.00 KiB/s, done.
From github.com:GitHubユーザー名/P28-4th-Ranking-Service
* [new branch]      main       -> origin/main


(main)
$ git merge --allow-unrelated-histories origin/main
Merge made by the 'ort' strategy.
README.md | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 README.md

(main)
$ git push origin main
Enumerating objects: 117, done.
Counting objects: 100% (117/117), done.
Delta compression using up to 8 threads
Compressing objects: 100% (114/114), done.
Writing objects: 100% (116/116), 170.32 KiB | 1.08 MiB/s, done.
Total 116 (delta 26), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (26/26), done.
To github.com:GitHubユーザー名/P28-4th-Ranking-Service.git
  5a53ab5..76ceace  main -> main


(main)
$ git rm -rf --cached △△
rm '△△'


(main)
$ git add -A

(main)
$ git commit -m "public_html 以下"
[main 3fb24ef] public_html 以下
597 files changed, 122353 insertions(+), 1 deletion(-)



(main)
$ git push origin main
Enumerating objects: 619, done.
Counting objects: 100% (619/619), done.
Delta compression using up to 8 threads
Compressing objects: 100% (599/599), done.
Writing objects: 100% (618/618), 109.27 MiB | 3.31 MiB/s, done.
Total 618 (delta 60), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (60/60), completed with 1 local object.
To github.com:GitHubユーザー名/P28-4th-Ranking-Service.git
  76ceace..3fb24ef  main -> main


プロジェクト追加作成


10.配置
今回は「SQL dumpdata」を配置。

11
(main)
$ git add -A

12
(main)
$ git commit -m "SQL dumpdata"
[main ebcbce8] SQL dumpdata
1 file changed, 682 insertions(+)
create mode 100644 mode_siterankin.sql


13
(main)
$ git push origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 20.23 KiB | 1.01 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:GitHubユーザー名/P28-4th-Ranking-Service.git
  3fb24ef..ebcbce8  main -> main



20.配置
今回は「スクリーンキャプチャ」を配置。

21
(main)
$ git add -A

22
(main)
$ git commit -m "Screen capture"
[main a6a38fc] Screen capture
2 files changed, 31542 insertions(+)


23
(main)
$ git push origin main
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 319.44 KiB | 3.76 MiB/s, done.
Total 4 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:GitHubユーザー名/P28-4th-Ranking-Service.git
  ebcbce8..a6a38fc  main -> main



2022 年 10 月 28 時点における、私が理想とする(Web系プロジェクトバックアップ用途)gitコマンド実行履歴。※これまで一度もこの通りに実行できたことはない



類似度ページランキング
順位 ページタイトル抜粋
1 Git BASH 作業履歴 2022/10/21 / P28 site-ranking(4Th-Ranking-Service) / 他の「.git」ディレクトリが存在した状態のまま下記gitコマンドを実行したため、意図せず「submodule」化されてしまった例 61
2 Git BASH 作業履歴 2022/10/20 / P48 site-rank(First-Ranking-Service) 2 / P25をP48のリポジトリへ反映させていたので、「git push -f origin main」で強制上書き実行 39
3 Git BASH 作業履歴 2022/10/21 / P13 pagerankingなど(Third-Ranking-Service) / 入力順番を間違えたためグダグダになってしまった例 36
4 Git BASH 作業履歴 2022/10/20 / P48 site-rank(First-Ranking-Service) / 「Add a README」後「git push -f origin main」実行したため、「README」削除 36
5 Git BASH 作業履歴 2022/10/20 / P25 manga-user-ranking(Second-Ranking-Service) / 「Add a README」後「git merge --allow-unrelated-histories origin/main」実行して、「README」もコミット履歴に含める 32
6 意図せずSubModule(ディレクトリに白い矢印)が作成された場合は、「$ git rm -rf --cached <対象ファイル or path>」後、「$ git add <対象ファイル or path>」 31
7 Git 失敗履歴2。「$ git reset」→ ソースコード削除。※Git BASH 経由で Windows10 から GitHub へ PUSH しようとするも、誤ってソースコードを削除してしまう 28
8 「2023 年 4 月 30 日」前後にTwitterアカウントが「SUSPENDED This App has violated Twitter Rules and policies.」と表示された場合には、「Downgrade」ボタンを押した方がよいと思われます。 28
9 「Twitter Developer」審査結果に通り、appを作成。しかし、いつの間にか「User is not Authorized」が表示されていたケース 27
10 2022 年 10 月 28 時点における、私が理想とする(Web系プロジェクトバックアップ用途)gitコマンド実行履歴。※これまで一度もこの通りに実行できたことはない 26
11 意図せずSubModuleが作成された場合は、「$ git rm -rf --cached <対象ファイル or path>」後、「$ git add <対象ファイル or path>」 26
12 「Twitter API」は、2023 年 5 月 10 日時点では、SMS認証(電話番号登録)不要でプロジェクト作成できるよう仕様変更されています。 23
13 「Twitter Developers」でアプリケーションを新規作成するためには? SMS認証用コードを確認可能な電話番号の登録が必要 23
14 「Windows10」へ「gitfor windows VERSION 2.18.0」をインストール 23
15 Git Bash で異なるディレクトリの指定ディレクトリへ移動する。「$ cd /L/3_開発/git/大阪府」 22
16 「Windows10」へ「gitfor windows VERSION 2.22.0」をインストール 22
17 GitHubのリポジトリ名を変更するためには、GitHubのWebページへアクセス。[Repositories] - [Settings]タブをクリック後、[Repository name]へ入力後、[Rename]ボタンをクリックする 22
18 「Twitter アカウント開設」のために受信可能なメールアドレスと、「Twitter Developersアカウント開設」のために受信可能なメールアドレスは仕様が異なる(と思われる) 21
19 「Twitter API」を利用するためには? / Twitter API v1.1 / OAuth 1.0A / OAuth 2.0 21
20 「This App has violated Twitter Rules and policies. As a result, it can no longer be accessed. For assistance, submit a support ticket.」と表示された場合、 21
2024/4/24 18:36 更新