カテゴリー:
Git BASH
閲覧数:125 配信日:2022-10-21 00:42
次回検証
正しい順番は恐らく下記
次回検証予定
1.
$ cd /L/1_Hp/0_sakura/2018server/var/www/html/1-p13
2.
$ git init
Initialized empty Git repository in L:/1_Hp/0_sakura/2018server/var/www/html/1-p
13/.git/
3.
$ git remote add origin git@github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
4.
$ git add -A
5.
$ git commit -m "first commit"
[main cde055a] first commit
1550 files changed, 69525 insertions(+)
create mode 100644 0webapp/LICENSE
create mode 100644 0webapp/MiniBlogApplication.php
必要かどうか要検証
→ 必要でした。
$ 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), 640 bytes | 5.00 KiB/s, done.
From github.com:GitHubユーザー名/P13-Third-Ranking-Service
* [new branch] main -> origin/main
6
$ git merge --allow-unrelated-histories origin/main
7
$ git push origin main
Enumerating objects: 1121, done.
Counting objects: 100% (1121/1121), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1104/1104), done.
Writing objects: 100% (1120/1120), 142.63 MiB | 3.30 MiB/s, done.
Total 1120 (delta 105), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (105/105), done.
To github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
a37f25e..cde055a main -> main
10.配置
11
$ git add -A
12
(main)
$ git commit -m "SQL dumpdata"
[main 0c9e7f9] SQL dumpdata
2 files changed, 1035 insertions(+)
create mode 100644 ibj_pagerankin.sql
create mode 100644 ibj_siterankin.sql
13
(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), 206.32 KiB | 1.88 MiB/s, done.
Total 4 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
cde055a..0c9e7f9 main -> main
20.配置
21
$ git add -A
22
(main)
$ git commit -m "Screen capture"
[main ecc78f7] Screen capture
4 files changed, 79386 insertions(+)
23
(main)
$ git push origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 774.81 KiB | 6.51 MiB/s, done.
Total 6 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), done.
To github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
0c9e7f9..ecc78f7 main -> main
入力順番を間違えたためグダグダになってしまった例
「$ git init」後いきなりコミットしたため、GitHubでレポジトリを作成する時に「README.md」追加した「Initial commit」とuserが異なると言っている?
とにかく入力順番を間違えると見たことがないエラーが表示される可能性があるため、要注意。
$ git init
Initialized empty Git repository in L:/1_Hp/0_sakura/2018server/var/www/html/1-p
13/.git/
$ git commit -m "first commit"
fatal: detected dubious ownership in repository at 'L:/1_Hp/0_sakura/2018server/
var/www/html/1-p13'
'L:/1_Hp/0_sakura/2018server/var/www/html/1-p13' is owned by:
'▲▲'
but the current user is:
'△△'
To add an exception for this directory, call:
git config --global --add safe.directory L:/1_Hp/0_sakura/2018server/var
/www/html/1-p13
$ git config --global --add safe.directory L:/1_Hp/0_sakura/2018server/var
/www/html/1-p13
bash: /www/html/1-p13: No such file or directory
$ git config --global --add safe.directory L:/1_Hp/0_sakura/2018server/var/www/html/1-p13
(main)
$ git commit -m "first commit"
On branch main
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
0webapp/
favorite/
■■/
pageranking/
□□/
nothing added to commit but untracked files present (use "git add" to track)
(main)
$ git remote -v
(main)
$ git remote add origin git@github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
(main)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P13-Third-Ranking-Service.git'
(main)
$ git merge --allow-unrelated-histories origin/main
merge: origin/main - not something we can merge
(main)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P13-Third-Ranking-Service.git'
(main)
$ git remote -v
origin git@github.com:GitHubユーザー名/P13-Third-Ranking-Service.git (fetch)
origin git@github.com:GitHubユーザー名/P13-Third-Ranking-Service.git (push)
(main)
$ git branch
(main)
$ git branch
(main)
$ git branch
(main)
$ git status
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
0webapp/
favorite/
■■/
pageranking/
□□/
nothing added to commit but untracked files present (use "git add" to track)
(main)
$ git commit -m "first commit"
On branch main
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
0webapp/
favorite/
■■/
pageranking/
□□/
nothing added to commit but untracked files present (use "git add" to track)
(main)
$ git add -A
(main)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P13-Third-Ranking-Service.git'
(main)
$ git merge --allow-unrelated-histories origin/main
merge: origin/main - not something we can merge
(main)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P13-Third-Ranking-Service.git'
(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), 640 bytes | 5.00 KiB/s, done.
From github.com:GitHubユーザー名/P13-Third-Ranking-Service
* [new branch] main -> origin/main
(main)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:GitHubユーザー名/P13-Third-Ranking-Service.git'
(main)
$ git merge
fatal: No remote for the current branch.
(main)
$ git merge --allow-unrelated-histories origin/main
(main)
$ git push origin main
Everything up-to-date
(main)
$ git log
commit a37f25e68fac30d5d2055e060720fda503e8257c (HEAD -> main, origin/main)
Author: GitHubユーザー名 <GitHubユーザー名@users.noreply.github.com>
Date: Fri Oct 21 00:00:21 2022 +0900
Initial commit
(main)
$ git push origin main
Everything up-to-date
(main)
$ git log
commit a37f25e68fac30d5d2055e060720fda503e8257c (HEAD -> main, origin/main)
Author: GitHubユーザー名 <GitHubユーザー名@users.noreply.github.com>
Date: Fri Oct 21 00:00:21 2022 +0900
Initial commit
(main)
$ git add -A
(main)
$ git commit -m "first commit"
[main cde055a] first commit
1550 files changed, 69525 insertions(+)
create mode 100644 0webapp/LICENSE
create mode 100644 0webapp/MiniBlogApplication.php
$ git push origin main
Enumerating objects: 1121, done.
Counting objects: 100% (1121/1121), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1104/1104), done.
Writing objects: 100% (1120/1120), 142.63 MiB | 3.30 MiB/s, done.
Total 1120 (delta 105), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (105/105), done.
To github.com:GitHubユーザー名/P13-Third-Ranking-Service.git
a37f25e..cde055a main -> main