给定 git root :
/Guardfile
/local (dir)
/.gitignore
Run Code Online (Sandbox Code Playgroud)
而.gitignore在本地,如何忽略Guardfile来自.gitignore本地的内部?
不想更改.gitignore根目录,因为它已签入 git。
我试过:
../Guardfile
Run Code Online (Sandbox Code Playgroud)
和
/Guardfile
Run Code Online (Sandbox Code Playgroud)
和
./../Guarfile
Run Code Online (Sandbox Code Playgroud)
git 版本 2.17.2
用例(因为有人可能会说“不要这样做”。)。这是很明显的,但我不想改变这个项目.gitignore。我将所有不属于 git 的文件保留在本地目录中。但Guardfile需要在根目录中。
我是 git 新手。我可以通过将多个文件或文件夹的名称或扩展名添加到 .gitignore 文件中来隐藏它们。
但是,其他人可能会看到我忽略了哪些文件/文件夹。我不知道是否有一种方法或设置可以使“只有你可以在 Github 上看到 .gitignore 文件”而不将存储库设为私有。
有什么方法可以对除了我自己(或仓库合作者)之外的其他人隐藏 .gitignore 文件吗?
在我的 Django 项目中,我已经在根目录中以及 django 项目中都有 .gitignore 文件,但是当我触发git status或git add .它将所有内容添加__pycache__ db.sqlite3到存储库中时。我需要从我的项目中删除这两件事。请帮忙。!
\n\n\n我分别在我的两个文件中尝试了诸如
\n*.sqlite3、mom/*.sqlite3、mom/db.sqlite3和 之类的所有内容。但任何东西在任何目录下都不起作用。db.sqlite3.gitignore
这是我的主要 git 忽略文件.gitignore
\n\nmedia\n*.sqlite3\n**/__pycache__/**\n*.pyc\nRun Code Online (Sandbox Code Playgroud)\n\n这是我的另一个 git 忽略文件.gitignore
\n\nmedia\ndb.sqlite3\n**/__pycache__/**\n*.pyc\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n\n我还尝试了在线资源中的许多可能性,但没有任何效果
\n
文件结构
\n\nMOM-PROJECT(local Repo)\n|\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80MOM (main project)\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80media\n| \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80media\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80MOM\n| \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80migrations\n| \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80templatetags\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80userprofile\n| \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80migrations\n| \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80__pycache__\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80templates\n| \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80MOM\n| \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80userprofile\n| \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80base.html\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80manage.py\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80requirements.txt\n| \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80db.sqlite3\n| \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80.gitignore [another …Run Code Online (Sandbox Code Playgroud) 我试图忽略命名目录中可能位于任何深度的除单个文件之外的所有文件。因此,在这样的结构中,我想跟踪 build/.gitkeep 的任何出现,但忽略 build/ 中及其下面的所有其他文件。要跟踪的项目标有 ++。要忽略的项目标有 --。
|.gitignore ++
|Makefile ++
|--build/ ++
|--build/.gitkeep ++
|--build/ignore_any_file --
|--build/ignore_any/dir --
|--foo/ ++
|--foo/file_to_keep ++
|--foo/dir_to_keep/ ++
|--foo/dir_to_keep/stuff ++
|--foo/build/ ++
|--foo/build/.gitkeep ++
|--foo/build/ignore_any_file --
|--foo/build/ignore_any/dir --
|--foo/build/ignore_any/dir/subir --
|--bar ++
|--bar/file_to_keep ++
|--bar/dir_to_keep/ ++
|--bar/dir_to_keep/stuff ++
|--bar/build/ ++
|--bar/build/.gitkeep ++
|--bar/ignore_any_file --
|--bar/ignore_any/dir --
|--bar/ignore_any/dir/subir --
|--foobar/foo ++
|--foobar/foo/file_to_keep ++
|--foobar/foo/dir_to_keep/ ++
|--foobar/foo/dir_to_keep/stuff ++
|--foobar/foo/build/ ++
|--foobar/foo/build/.gitkeep ++
|--foobar/foo/build/ignore_any_file --
|--foobar/foo/build/ignore_any/dir --
|--foobar/foo/build/ignore_any/dir/subir --
Run Code Online (Sandbox Code Playgroud)
我尝试过很多很多组合。对我来说,关键点似乎是在任何深度都有 build/ 。我试图避免为 build/ 存在的每个路径创建条目。我也不想在 build/ 的每个实例中创建 …
我正在制作 flutter 应用程序,并尝试将包含密码的“key.properties”文件添加到 gitignore 文件中。在我的 android/.gitignore 文件中,我写道
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
/key.properties
Run Code Online (Sandbox Code Playgroud)
像这样,我认为它会使 key.properties 文件在我的 git hub 上被忽略,但是当我推送代码时,我仍然可以在 GitHub 上看到它。我写的方法对吗??
我有一个包含.env文件的node.js 项目。我推送到了 github 项目,当时.env文件只是一个模板。例如:
# Database credentials
DB_HOST=""
DB_USER=""
DB_PASSWORD=""
DB_DATABASE_NAME=""
Run Code Online (Sandbox Code Playgroud)
然后我将.env文件添加到.gitignore. 现在再次按下,当我.env用凭据填充文件时,git status命令说
修改:.env
如何在 github 中存储文件模板.env并忽略它的更改?
这是一个关于 Android 上的 Git、.gitignore 的问题!
=================================================== ====
Q1) myproject/app/.cxx 中创建了哪些文件?
我在android项目中使用ndk,jni。似乎与此相关的文件在 myproject/app/.cxx 中被自动更改。
当我尝试分支移动时,此文件夹中的文件被更改,因此我遇到了必须提交的问题。
所以我想将该目录添加到 .gitignore,我不知道该目录到底是什么,所以我想知道是否可以将其添加到 .gitignore
=================================================== ====
Q2)我有多个 .gitignore 文件。
如果我将该目录 (myproject/app/.cxx) 添加到 .gitignore,
“myproject”文件夹中还有一个 .gitignore 文件,
“myproject/app”文件夹中还有一个 .gitignore 文件。
我应该在“myproject/app”中编辑 .gitignore 吗?
我想忽略git 项目workspace文件夹内的文件。为此.obsidian/我修改了我的文件。.gitignore
这是我的 .gitignore 文件:
\n .obsidian/cache\n .obsidian/workspace\n .trash/\n .DS_Store\nRun Code Online (Sandbox Code Playgroud)\n但是,当文件更改时我仍然收到此消息:
\n .obsidian/cache\n .obsidian/workspace\n .trash/\n .DS_Store\nRun Code Online (Sandbox Code Playgroud)\n我不知道为什么会发生这种情况或该怎么办。
\n在 IntelliJ 中初始化 Git 时,会在 .idea 文件夹中创建一个 .gitignore 文件。但是,我看到的许多有关 .gitignore 文件的建议都说忽略 .idea 文件夹。这不会忽略 .gitignore 文件本身,或者不可能吗?.gitignore 文件应该位于哪里?