Github가 저장소를 잘못된 언어로 변경합니다.
나는 이것이 큰 문제가 아니라는 것을 알고 있지만 Github가 언어 적으로 다양하다는 것을 좋아합니다. Swift로 프로젝트를 작성했는데 커밋하면 Objective C에 있다고 표시됩니다.
Parse 프레임 워크가 Objective C로 작성되었고이를 감지했기 때문일 수 있지만 기본 저장소 페이지에서 표시 언어를 변경할 수있는 방법이 있습니까?
가장 간단한 방법은 내 저장소의 루트 폴더에 .gitattributes라는 파일을 만들고 다음 내용을 제공하는 것입니다.
* linguist-vendored
*.js linguist-vendored=false
이 예제는 github / linguist에게 모든 파일을 무시하고 .js 파일 만 보도록 지시합니다. HTML 예제 파일이 JS 파일보다 크기 때문에 내 프로젝트 https://github.com/aim12340/jQuery-Before-Ready 가 HTML로 나열되었습니다. 이 파일은 나를 위해 그것을 수정하고 이제 JavaScript로 나열됩니다.
GitHub 도움말 페이지 에서 언급했듯이
GitHub는 오픈 소스 Linguist 라이브러리 를 사용하여 구문 강조 표시 및 저장소 통계를위한 파일 언어를 결정합니다.
일부 파일은 식별하기 어렵고 프로젝트에는 기본 코드보다 더 많은 라이브러리 및 공급 업체 파일이 포함되어 있습니다.
따라서이 github/linguist#troubleshooting
상황을 해결하려면 확인해야합니다 .
백분율은 List Languages API 에서보고하는 각 언어의 코드 바이트를 기준으로 계산 됩니다 .
바에서 예상치 못한 언어를보고하는 경우 :
- 통계 표시 줄에서 언어 이름을 클릭하면 해당 언어로 식별되는 파일 목록이 표시됩니다.
- 작성하지 않은 파일이있는 경우 공급 업체 코드 경로 중 하나로 파일을 이동 하거나 수동 재정의 기능 을 사용하여 무시하세요.
- 파일이 잘못 분류 된 경우 미해결 문제 를 검색하여 다른 사람이 이미 문제 를보고했는지 확인합니다. 추가 할 수있는 모든 정보, 특히 공용 저장소에 대한 링크가 유용합니다.
- 이 잘못 분류에 대해보고 된 문제가없는 경우 문제를 열고 잘못 분류 되는 코드 샘플 또는 저장소에 대한 링크를 포함합니다.
2017 년 2 월 업데이트 (1 년 후) :
Monica Powell의 " GitHub에서 Repo 언어를 변경하는 방법 "기사
GitHub가 프로젝트 언어를 잘못 분류하는 것을 해결하는 방법을 조사한 결과, GitHub에 무시할 파일을 알려주는 것만 큼 간단하다는 것을 알게되었습니다.
당신은 아직 사용할 수 없습니다, 따라서 GitHub의에이 파일을 커밋하고 싶어하지만
.gitignore
당신은에서 무시할 파일 GitHub의의 언어 학자 말할 수있는.gitattributes
파일을
static/* linguist-vendored
이 한 줄 파일은 GitHub에 내
static/
폴더의 모든 파일을 무시하라고 지시했습니다.이 폴더는 Flask 앱에 대해 CSS 및 기타 자산이 저장되는 위치입니다.
"사용 .gitattributes
"부분은 잘못된 언어를 표시하는 방법을 보여 않습니다.
예를 들면 :
자바 스크립트 라이브러리와 같이 작성하지 않은 코드를 git 저장소에 확인하는 것은 일반적인 관행이지만 이 경우 종종 프로젝트의 언어 통계가 부풀려지고 프로젝트에 다른 언어로 라벨이 지정 될 수도 있습니다 .
기본적으로 Linguist는에 정의 된 모든 경로vendor.yml
를 공급 업체로 취급 하므로 저장소의 언어 통계에 포함하지 않습니다.linguist-vendored 속성을 공급 업체 또는 비 공급 업체 경로에 사용합니다.
$ cat .gitattributes
special-vendored-path/* linguist-vendored
jquery.js linguist-vendored=false
간단하게하기 위해 내 단계를 공유하겠습니다.
프로젝트 루트 폴더로 디렉토리를 변경하십시오.
원하는 도구를 사용하여 .gitattributes라는 파일을 만듭니다.
.gitattributes 터치
Linguist 라이브러리 지침 에 따라 파일을 편집하여 Github에 방법을 알려주십시오. 예를 들면 다음과 같습니다.
vi .gitattributes
linguist-vendored를 사용하면 Github에서이 폴더 및 하위 폴더에 대한 탐지를 "건너 뛰기"할 수 있습니다.
src/main/resources/static/* linguist-vendored
linguist-documentation 속성을 사용하여 경로를 문서로 표시하거나 표시 해제합니다.
project-docs/* linguist-documentation
또는 문서가 포함 된 개별 파일에 표시
documented_code.rb linguist-documentation=true
이것은 약간 이상하지만 또한 할 수 있습니다-Github에 특정 확장자 (예 : * .rb)를 가진 일부 파일을 Java로 처리하도록 지시하기 위해 :
*.rb linguist-language=Java
Git 추가, 커밋 및 Github에 푸시하면 레이블이 거의 즉시 수정됩니다.
.gitattributes를 이것으로 바꾸면 모든 파일이 Java로 재 분류 됩니다.
*.* linguist-language=Java
.gitattributes 파일에서 Linguist에게 원하지 않는 파일 언어를 결정하지 않도록 지시하십시오.
자바 스크립트 파일을 무시하는 예입니다.
*.js linguist-vendored
You may avoid unexpected languages detection (by extension, or by project subfolder etc) by using github linguist detectable option: in your .gitattributes file:
Only programming languages are included in the language statistics. Languages of a different type (as defined in
languages.yml
) are not "detectable" causing them not to be included in the language statistics.Use the
linguist-detectable
attribute to mark or unmark paths as detectable:
*.kicad_pcb linguist-detectable=true
*.sch linguist-detectable=true
tools/export_bom.py linguist-detectable=false
Create .gitattributes file in the root of your folder. Suppose you want the language to be Java, just copy-paste
*.java linguist-detectable=true *.js linguist-detectable=false *.html linguist-detectable=false *.xml linguist-detectable=false
in the .gitattributes file and push the file in the repo.Refresh your GitHub page to see the language change.
Note: So ,for the desired language make it true and other's false.It should work fine
I had a project that was started in Objective-C and changed to Swift completely (new project but in same repository dir). Github kept identifying it as Objective-C no matter what I have put in gitattributes. (all solutions above)
So, if the jig is up, and you're sure all project is one language - you radically put:
Only that fixed the problem :)
Create a file named .gitattributes to your project root folder. Adding {file_name} linguist-generated=true
can do the trick. In my case,
mvnw.cmd linguist-generated=true
mvnw linguist-generated=true
worked for me.
The solution which was provided by the expert EamonnM who answered this question above worked in my project, but there's two significant things.
The language in the beginning of the second line of his code was the language you want instead of the language you dislike. Remember to distinguish it.
It seems that you could not type any space before the
*
. (For example, I should type*.swift linguist-vendored=false
when I want to change my language into swift.)
참고URL : https://stackoverflow.com/questions/34713765/github-changes-repository-to-wrong-language
'Development Tip' 카테고리의 다른 글
클래스의 매개 변수에 전달 된 null을 일치시키는 방법 (0) | 2020.10.20 |
---|---|
Oracle에서 사용자에게 부여 된 권한 및 역할을 찾는 방법은 무엇입니까? (0) | 2020.10.20 |
클래스의 모든 메서드가 먼저 다른 메서드를 호출하는지 확인하는 방법은 무엇입니까? (0) | 2020.10.20 |
마지막으로 CSS 변경 (0) | 2020.10.20 |
자바의 문자열 비교 (0) | 2020.10.20 |