gpt4 book ai didi

git - 将新创建的特定文件夹添加到 Git 中的 .gitignore

转载 作者:IT王子 更新时间:2023-10-29 00:32:34 24 4
gpt4 key购买 nike

我有一个干净的工作目录,昨晚从 Git 存储库中克隆了一个。但是现在我的本地服务器创建并包含一个我想忽略的统计文件夹。

当我运行 git status 时,我似乎无法让 Git 忽略这个文件夹。

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

Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

new file: app_public/views/pages/privacy.php
new file: app_public/views/pages/terms.php
new file: public_html/stats/ctry_usage_200908.png
new file: public_html/stats/daily_usage_200908.png
new file: public_html/stats/dns_cache.db
new file: public_html/stats/hourly_usage_200908.png
new file: public_html/stats/index.html
new file: public_html/stats/usage.png
new file: public_html/stats/usage_200908.html
new file: public_html/stats/webalizer.current
new file: public_html/stats/webalizer.hist

Changed but not updated:
modified: .gitignore

我在 .gitignore 中添加了一些不同的行,但它仍在尝试添加它们:

public_html/stats
public_html/stats/**
public_html/stats/**/*
public_html/stats/*

最佳答案

试试 /public_html/stats/*

但是由于 git status 中的文件报告为 to be committ 这意味着您已经手动添加了它们。当然,在这种情况下,再忽视就太晚了。你可以 git rm --cache 它们 (IIRC)。

关于git - 将新创建的特定文件夹添加到 Git 中的 .gitignore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1335302/

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