gpt4 book ai didi

git - 在文件夹中执行 git init 但 git 无法添加一些子文件夹

转载 作者:太空狗 更新时间:2023-10-29 14:28:46 25 4
gpt4 key购买 nike

当我使用 git 初始化我使用 hugo newsite hugo-g 创建的根文件夹时,我发现并不是根文件夹中的所有子文件夹都被添加到 git。

以下是文件权限的详细信息:

╰─ ll -al
total 16
drwxr-xr-x 12 robot staff 384B Jul 20 22:50 .
drwxr-xr-x 51 robot staff 1.6K Jul 18 16:22 ..
drwxr-xr-x 9 robot staff 288B Jul 20 22:50 .git
drwxr-xr-x 3 robot staff 96B Jul 10 17:56 archetypes
-rw-r--r-- 1 robot staff 7.8K Jul 20 20:23 config.toml
drwxr-xr-x 4 robot staff 128B Jul 20 21:11 content
drwxr-xr-x 2 robot staff 64B Jul 10 17:56 data
drwxr-xr-x 2 robot staff 64B Jul 10 17:56 layouts
drwxr-xr-x 13 robot staff 416B Jul 20 22:01 public
drwxr-xr-x 3 robot staff 96B Jul 19 11:13 resources
drwxr-xr-x 2 robot staff 64B Jul 10 17:56 static
drwxr-xr-x 7 robot staff 224B Jul 20 22:33 themes

下面是我完成操作后的结果:git init

╰─ git init
Initialized empty Git repository in /Users/robot/code/interests/hugo-g/.git/
╰─ ls
archetypes config.toml content data layouts public resources static themes
╰─ git status
On branch master

No commits yet

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

archetypes/
config.toml
public/
themes/

nothing added to commit but untracked files present (use "git add" to track)


#I tried with commands provided by @Sepideha and @melpomene, but it still not works, and the result is like this.

git add .
git status
new file: archetypes/default.md
new file: config.toml
new file: public/404.html
new file: public/archives/index.html
new file: public/archives/index.xml
new file: public/categories/index.html
new file: public/categories/index.xml
new file: public/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css
new file: public/images/cover-v1.2.0.jpg
new file: public/images/cover.jpg
new file: public/index.html
new file: public/index.xml
new file: public/js/script-pcw6v3xilnxydl1vddzazdverrnn9ctynvnxgwho987mfyqkuylcb1nlt.min.js
new file: public/page/1/index.html
new file: public/sitemap.xml
new file: public/tags/index.html
new file: public/tags/index.xml
new file: themes


git add *
git status

new file: archetypes/default.md
new file: config.toml
new file: public/404.html
new file: public/archives/index.html
new file: public/archives/index.xml
new file: public/categories/index.html
new file: public/categories/index.xml
new file: public/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css
new file: public/images/cover-v1.2.0.jpg
new file: public/images/cover.jpg
new file: public/index.html
new file: public/index.xml
new file: public/js/script-pcw6v3xilnxydl1vddzazdverrnn9ctynvnxgwho987mfyqkuylcb1nlt.min.js
new file: public/page/1/index.html
new file: public/sitemap.xml
new file: public/tags/index.html
new file: public/tags/index.xml
new file: themes

the subfolder like data, content,layouts, resources... still miss.


tree -L 2
╰─ tree -L 2
.
├── archetypes
│   └── default.md
├── config.toml
├── content
│   ├── page
│   └── post
├── data
├── layouts
├── public
│   ├── 404.html
│   ├── archives
│   ├── categories
│   ├── css
│   ├── images
│   ├── index.html
│   ├── index.xml
│   ├── js
│   ├── page
│   ├── sitemap.xml
│   └── tags
├── resources
│   └── _gen
├── static
└── themes
├── AllinOne
├── BeyondNothing
├── Binario

操作系统:Darwin robot.local 18.6.0 Darwin 内核版本 18.6.0:2019 年 4 月 25 日星期四 23:16:27 PDT;根目录:xnu-4903.261.4~2/RELEASE_X86_64 x86_64混帐版本:版本 2.20.0hugo-version: Hugo Static Site Generator v0.55.6/extended darwin/amd64 构建日期:未知go-version: go版本go1.12.5 darwin/amd64

我希望根目录下的所有子目录都可以加入git。

最佳答案

git init 不添加任何文件。它只是创建一个(最初是空的)存储库。

如果要将目录下的所有文件和子目录都添加到版本库中,需要

git add .
git commit

(后一个命令将打开一个文本编辑器,因此您可以键入您的第一个提交消息。)

关于git - 在文件夹中执行 git init 但 git 无法添加一些子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57125918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com