Published: 10 Feb 2018 › Updated: 10 Feb 2018![[smartcontrct] 如何讓你的 github project 的語言欄位顯示 solidity](https://i.ecency.com/p/5k2tWE6P7gjtWGNDHKvBHJvQxPjtvFUGBSejnemt?format=match&mode=fit&height=377)
[smartcontrct] 如何讓你的 github project 的語言欄位顯示 solidity
假如你使用 Truffle 開發 smart contract, 那麼 上傳 Github 後你就會發現你的 project是被歸類為 javascript. 這是為什麼呢 ? 這是因為 solidity 的檔名就是 .sol。這個 github 不會認為他是 solidity。 github 使用 linguist 這個套件偵測語言。 簡單的說 linguist 這個套件認為 sol 這副檔名太通用所以不會認定他是 solidity。 詳情可以看 solidity 上的 issue討論。
根據討論解決方法有兩種,這邊會採用就簡易法 - 也就是使用 .gitattributes 檔來解決。你可以參考 gitattribute Document Link。但接下來我直接就把解決步驟寫出。
- 在你的 truffle project 裡創建一個新檔案叫 .gitattributes
- 參考我的 .gitattributes 內容加到你創建的檔案裡
# Source files
# ============
*.sol linguist-language=Solidity
*.js text
- commit 然後上傳到 github
- 在 project 頁面你會看到正確的語言分佈。原本只有 javascript 而已
- 在 project 列表中你會看到你的 smart contract 顯示 solidity
Leave [smartcontrct] 如何讓你的 github project 的語言欄位顯示 solidity to:
Read more #ethereum posts
Best Posts From pieceofr
We have not curated any of pieceofr's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From pieceofr
- One Amnesty Talk 愛爾蘭平權運動分享
- [presntation slide] 來去世界最先進的超市買東西
- [smartcontrct] 如何讓你的 github project 的語言欄位顯示 solidity
- [crypto][presentation slide] CryptoKitties - A Quick Walkthrough Of Its Smart Contract
- [echo]Amazon Alexa 開發快速入門
- [crypto] CryptoKitties 加密喵喵教學
- [tutorial] RLadies 要上 Github (presentation slide)
- [tutorial] 初學者的 Github (presentation slide)
- [Crypto] Power Ledger 介紹