0
我已經在GitHub中創建了一個存儲庫,並試圖提交超過大小限制的文件。這導致了一條錯誤消息。 我已經創建了一個.gitignore文件,我保存在我的項目的主目錄中,其中包含一個排除所有.csv文件的規則。完全刪除git存儲庫
# History files
.Rhistory
# Example code in package build process
*-Ex.R
# R data files from past sessions
.Rdata
.Rd
# .csv files which in this case are too heavy (> 100mb)
# You can download training and test datasets at this URL --> http://www.kaggle$
.csv
我又試圖再次提交,但不幸的是Git的嘗試也提交該.csv文件,隨着新創建的.gitignore文件。
考慮的.gitignore方式沒有排序我的問題,我已經嘗試使用這個命令來刪除緩存文件,並試圖再次推:不幸的是也
$ git rm --cached data/train.csv data/test.csv
$ git commit -m "Remove heavy .csv files
$ git push -u origin master
在這種情況下,Git是試圖上傳.csv文件。 我想我需要創建主分支,因爲在GitHub中存儲庫仍然是空的。
順便說一句,git status
命令不返回新文件提交。
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# data/
nothing added to commit but untracked files present (use "git add" to track)
我該怎麼辦?
你說的是庫在github中爲空。爲什麼不克隆空的存儲庫,添加'.gitignore'和push? –
您也可以刪除.git子目錄,重新初始化存儲庫,添加並提交gitignore文件,然後更有選擇地重新添加其他文件。請記住,git是爲了管理源代碼。它不適用於二進制文件和數據集等。 – IanH
記住這一切都假設你從第一次提交開始,因爲這兩個都會失去你的歷史(因爲這是你的問題)。 – Leigh