[英]How can I configure git, so that node_modules can be versioned locally but ignored when pushing?
如何配置git,以便可以在本地對node_modules進行版本控制,但在推送時將其忽略? 有可能嗎?
原因:不同的打包系統(例如npm / yarn / ..)訪問node_modules
,有時某些包損壞。 我們要監視哪些工具發生了確切的變化。 並且不應將node_modules推送到開發服務器上。
這不可能。
您可以做的是從Git存儲庫中排除node_modules
並在node_modules
創建一個新的Git存儲庫
您可以定義以下結構:
/project
/my_node_modules
git init
在my_node_modules
創建新的存儲庫 node_modules
位置更改為文件夾/my_node_modules
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.