git - Git 说我的 .gitignore 路径无效,无法添加
问题描述
我有一个非常简单的问题,我不明白出了什么问题。我正在尝试暂存我的 .gitignore 文件以进行提交,但 Git 说路径无效。就这么平淡。我的终端输出粘贴在下面。如您所见,.gitignore 文件确实存在,但我无法添加它。
magnus@magnus:~/Documents/deep-rl-hex$ git status
On branch neural_net_added
Your branch is up to date with 'origin/neural_net_added'.
nothing to commit, working tree clean
magnus@magnus:~/Documents/deep-rl-hex$ ls -alt .git/
total 68
drwxr-xr-x 8 magnus magnus 4096 nov. 13 17:48 .
-rw-r--r-- 1 magnus magnus 2436 nov. 13 17:48 index
-rw-r--r-- 1 magnus magnus 41 nov. 13 17:48 ORIG_HEAD
drwxr-xr-x 5 magnus magnus 4096 nov. 13 17:48 refs
drwxr-xr-x 160 magnus magnus 4096 nov. 13 17:48 objects
-rw-r--r-- 1 magnus magnus 1427 nov. 13 17:39 .gitignore #.gitignore file is indeed here
drwxr-xr-x 5 magnus magnus 4096 nov. 13 17:38 ..
-rw-r--r-- 1 magnus magnus 33 nov. 13 17:38 HEAD
-rw-r--r-- 1 magnus magnus 221 nov. 13 17:38 FETCH_HEAD
-rw-r--r-- 1 magnus magnus 348 nov. 13 17:28 config
-rw-r--r-- 1 magnus magnus 4 nov. 13 17:27 COMMIT_EDITMSG
drwxr-xr-x 3 magnus magnus 4096 okt. 27 14:35 logs
-rw-r--r-- 1 magnus magnus 114 okt. 27 14:35 packed-refs
drwxr-xr-x 2 magnus magnus 4096 okt. 27 14:35 hooks
drwxr-xr-x 2 magnus magnus 4096 okt. 27 14:35 info
drwxr-xr-x 2 magnus magnus 4096 okt. 27 14:35 branches
-rw-r--r-- 1 magnus magnus 73 okt. 27 14:35 description
magnus@magnus:~/Documents/deep-rl-hex$ git add .git/.gitignore
error: Invalid path '.git/.gitignore'
error: unable to add .git/.gitignore to index
fatal: adding files failed
这里有什么问题?很明显,我缺少一些基本的东西,但我不知道是什么。
解决方案
在 .git 目录中添加一个文件。那是一个no no
。
推荐阅读
- amazon-web-services - node-red-node-aws 输出节点文件名属性
- r - 在R中的条件下删除行
- android - Android 画外音未在状态更新时公布
- node.js - 使用节点 js 显示验证错误消息的特定错误消息
- spring-boot - 使用 Spring Boot 登录 Facebook OAuth2
- woocommerce - WooCommerce 在不同页面上的购物车中的不同产品
- javascript - Nodejs将变量添加到导入的html字符串中
- python - Deepquantiles TypeError: super(type, obj): obj 必须是类型的实例或子类型?
- c - 让用户在 C 中每次只按一次回车
- repast-simphony - Repast - 使用代理监视器定位和跟踪特定代理