我最近想要将我的dotnetnuke网站上传到git上,但是我的网站有大量图片,我不想通过git上传。
我在GIT上搜索时发现了.gitignore文件,并在创建仓库时自动生成,在GIT中有关于忽略文件/文件夹及其特定子文件夹的文档,但似乎在我的情况下无法使用。
这是我的文件夹结构:
*******已更新*******.gitignore
public_html/Portals/_default/
public_html/Portals/0/
public_html/Portals/1/
public_html/Portals/110/
现在我想忽略除了Portals/_default之外的所有Portals文件夹。 我根据GIT的规范尝试了如下操作:
Example to exclude everything except a specific directory foo/bar (note the /* - without the slash, the wildcard would also exclude everything within foo/bar):
$ cat .gitignore
# exclude everything except directory foo/bar
/*
!/foo
/foo/*
!/foo/bar
以下是我尝试过的内容:
!/Portals
/Portals/*
!/Portals/_default
但是这似乎根本行不通。
有人能够指导我吗?
public_html
文件夹。将你的gitignore移动到public_html
或在每一行中添加public_html
文件夹。 - Johannes Thorn