Я выполнил git фиксацию и смог успешно передать sh файл в удаленное хранилище. После проверки дерева git фиксации, не удалось найти blob ha sh, который был зафиксирован в git.
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ vi second-file.txt
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
second-file.txt
nothing added to commit but untracked files present (use "git add" to track)
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git add .
warning: LF will be replaced by CRLF in src/main/resources/second-file.txt.
The file will have its original line endings in your working directory
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git commit
[master 3fb459d] Git Commit#2
1 file changed, 1 insertion(+)
create mode 100644 src/main/resources/second-file.txt
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git status
On branch master
nothing to commit, working tree clean
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git push --set-upstream origin master
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 497 bytes | 497.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
To https://gitlab.com/shalabh_chaturvedi/gittest.git
8d6d403..3fb459d master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git log
commit 3fb459d6a2104d8335e27b45b8f79f20aca78428 (HEAD -> master, origin/master)
Author: Shalabh Chaturvedi <shalabhchaturvedi@icloud.com>
Date: Tue Aug 4 01:11:59 2020 +0530
Git Commit#2
Add second file with some git commands
commit 8d6d403def38cf8b611b14823d15455b4dc20c5a
Author: shalabh chaturvedi <shalabhchaturvedi@icloud.com>
Date: Sat Aug 1 22:14:40 2020 +0530
Commit id #1
Create a file Intro.txt with content 'Hello git'
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git cat-file -p 3fb459d6a2104d8335e27b45b8f79f20aca78428
tree 93fc6f1481138e1d2de420f2d834a1c8b02a9259
parent 8d6d403def38cf8b611b14823d15455b4dc20c5a
author Shalabh Chaturvedi <shalabhchaturvedi@icloud.com> 1596483719 +0530
committer Shalabh Chaturvedi <shalabhchaturvedi@icloud.com> 1596483719 +0530
Git Commit#2
Add second file with some git commands
Shalabh@LAPTOP-O9UDCPOI MINGW64 ~/IdeaProjects/gittest/src/main/resources (master)
$ git cat-file -p 93fc6f1481138e1d2de420f2d834a1c8b02a9259
100644 blob 70ebc1f9607fab6ed8fc5fa58f0f582716f07f50 pom.xml
040000 tree 01267bfb4ca46c032b5ed7954be3e3c72630d0fe src
В учетной записи gitlab я вижу 'second-file.txt' прикреплен к фиксации. Использовал ли я неправильные команды или есть ли другой способ прикрепить файл к дереву? sh.
Спасибо за ваш ответ.