如何从 GitHub 存储库中删除不正确的路径名?

How to remove a incorrect pathname from a GitHub repository?

如果你看一下 my repository or GitHub,你可以看到它有路径 /Documents/NetbeanProjects/

我以前从未让它这样做过,我如何配置 Netbeans 或 GitHub 不包含它?
我不知道我为此做了什么。

很有可能是你最近误加和提交的。要删除它,你可以做

git rm --cached -r Documents/NetbeanProjects/REPONAME
echo "Documents/NetbeanProjects/REPONAME" >> .gitignore
git add .gitignore
git commit -m "Removing Incorrectly corrected REPONAME and adding to gitignore"

Edit:您在错误的目录中创建了存储库,而不是在 Documents/NetBeansProjects/reponame 中创建它,您有在主目录中创建它。

因此,在正确的文件夹中重新创建您的存储库并使用

删除当前的存储库
rm -rf .git/
cd Documents/NetBeansProjects/REPONAME && git init
git add . && git commit -m "Initialising project"