git推送未跟踪的文件

时间:2018-02-21 16:10:43

标签: git github git-push git-track

~/D/s/b/h_adv_ML (master±) ▶︎︎ git ls-files --error-unmatch *.csv
test_rmse.csv
train_rmse.csv
error: pathspec 'genome-scores.csv' did not match any file(s) known to git.
error: pathspec 'genome-tags.csv' did not match any file(s) known to git.
error: pathspec 'links.csv' did not match any file(s) known to git.
error: pathspec 'movies.csv' did not match any file(s) known to git.
error: pathspec 'ratings.csv' did not match any file(s) known to git.
error: pathspec 'tags.csv' did not match any file(s) known to git.
Did you forget to 'git add'?
~/D/s/b/h_adv_ML (master±) ▶︎︎ git commit -m " clean3"
[master b31185a]  clean3
 2 files changed, 1 insertion(+), 465566 deletions(-)
 delete mode 100644 tags.csv
~/D/s/b/h_adv_ML (master) ▶︎︎ git push origin master
Counting objects: 36, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (35/35), done.
Writing objects: 100% (36/36), 192.26 MiB | 2.17 MiB/s, done.
Total 36 (delta 12), reused 0 (delta 0)
remote: Resolving deltas: 100% (12/12), completed with 1 local object.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 70338ad9481eef83938b427ed955775e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File genome-scores.csv is 308.56 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File ratings.csv is 508.73 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/<...>/h_adv_ML.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/<...>/h_adv_ML.git'

当它们没有被跟踪时,它试图推动它们!我在这里错过了什么? 我不确定为什么要推动#34; genome-scores.csv&#34;和&#34; ratings.csv&#34;当他们没有跟踪时。

$ git status
On branch master
Your branch is ahead of 'origin/master' by 8 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
 $ tree
.
├── README.md
├── README.txt
├── check.py
├── check_old.py
├── code.py
├── genome-scores.csv
├── genome-tags.csv
├── links.csv
├── movies.csv
├── old_code.py
├── ratings.csv
├── read_py.py
├── tags.csv
├── test_rmse.csv
└── train_rmse.csv

1 个答案:

答案 0 :(得分:1)

我已经发表了一些评论,但我认为我已经提出了一个相当基本的解决方案 - 自上次推动以来你需要“压缩”提交。

  1. 识别遥控器上的最后一次提交。您可以使用git log --oneline执行此操作,并查找旁边有origin/master的提交。然后复制提交的ID,这是行开头约7个字符的十六进制字符串。

  2. git reset COMMIT(例如git reset abcdef0)将取消所有提交并“取消”它们。这意味着自提交以来所做的所有更改(包括该提交)都将从Git中删除,但保留在您的文件系统中。

  3. 确定您要保留的重置提交中所做的任何更改并重新发送它们。它应告诉您上一个命令后的“重置后的未分级更改”。

  4. 您应该能够将已提交的更改推送到Github存储库。

  5. 稍微程序化的版本:

    # get sha1 revision of origin/master and reset to that
    git reset $(git rev-parse origin/master)
    
    # git add via patch, so you can moderate what you add
    git add -p
    
    git commit
    git push
    
相关问题