簡體   English   中英

git repo是手動復制到服務器的,感染后如何將文件與repo進行比較?

[英]git repo was copied manually to server how can I diff the files against the repo after infection?

我們的網絡服務器上的一個域最近遭到黑客入侵,我需要對我們的存儲庫進行git diff處理。 但是問題是服務器上沒有安裝git,我相信使用ssh推送了倉庫。

現在已經安裝了Git,是否可以初始化git,以便它現在知道其來源? 或者我可以對回購做一個git diff嗎?

一如既往地感謝您的幫助:)

謝謝

是的,這是可能的:

  1. 將您的文件夾轉換為git工作副本:

     cd /path/to/working-to-be-copy/ # replace with actual path git init git remote add origin url-to-git-remote # replace with actual url git fetch 
  2. 讓git認為此工作副本已簽出此特定提交:

     git reset --mixed origin/master # or whatever branch/commit you want to diff against 
  3. 檢查結果:

    顯示總體情況,包括被忽略的文件(請注意:如果更改了.gitignore ,則git將使用工作副本版本):

     git status --ignored 

    顯示所選提交和實際文件之間的差異(但是不包括未跟蹤/忽略的文件):

     git diff 

暫無
暫無

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

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