簡體   English   中英

如何集成Git + Github + Google雲端硬盤?

[英]How to integrate Git + Github + Google Drive?

我在兩台計算機上運行Git,機器A(OS X)和機器B(Windows 10),同時在Github上進行遠程托管。 我在機器A和B上的本地工作目錄都已與Google雲端硬盤同步。

我前幾天注意到,無論何時我在機器A上進行提交(即使沒有發生任何更改),機器B突然都修改了需要暫存和提交的文件。

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   README.md
        modified:   helper_scripts/scriptA.py
        modified:   helper_scripts/scriptB.py
        modified:   helper_scripts/scriptC.py
        modified:   helper_scripts/scriptD.py

no changes added to commit (use "git add" and/or "git commit -a")

在計算機B上運行以下命令后,

git add .
git commit -m 'some message'

我在機器B上收到以下消息:

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

nothing to commit, working tree clean

然后,我在機器A上檢查git status ,並且整個過程一次又一次地重復……這似乎是不正常的行為,因為我沒有對文件進行任何更改。 我假設Google雲端硬盤同步以某種方式導致了此問題。

如何才能使Git,GitHub和Google Drive一起玩得開心,從而避免我似乎陷入了這種惡性循環?

只是不要。

git repo損壞只是時間問題,您將失去工作。 認真地,找到一種更好的方式來備份您的工作。

首先,仔細檢查計算機B中報告的差異的性質(Windows)

使用全新的同步存儲庫重試,但這一次是第一次鍵入完成的(在Windows上)

git config core.autocrlf false

這將阻止Git對文件進行一些自動修改以更改eol樣式(LF與CFRL行尾)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM