Change language on github

Asked

Viewed 3,924 times

2

I have a project developed in Python with Django. I just created a repository and pulled on github and the project was set to PHP on the Github website:

inserir a descrição da imagem aqui

Some images of my project and its files:

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

So:

  • Does anyone know how and why Github made this choice? I don’t have any php files in this project. (When I created this question I made a mistake. See in my reply that I had 2 files. php yes)
  • How do I change the language to Python?
  • You just sent it to the repository or you are trying to publish as Gitpage ?

  • I created a repository on the github site and uploaded the project onto it. The strange thing is that I went up the same project on Gitlab and it didn’t happen. I wanted to understand what Github used as the basis for deciding on PHP, and I don’t have any php files in the project

  • @hugocsl has nothing to do with gitpage the question is about the same repository.

  • There’s no way to know why he pointed to PHP if you don’t detail the question, something has to be in your repository.

  • Incidentally this user? Well, in the general listing shows nothing in PHP

  • @Guilhermenascimento I asked because Gitpagem does not accept anything other than html/css/js, so it could be giving some "generic" warning if it was trying to publish as Page

  • It’s because the repository is private. Only I have access to it @Jeffersonquesado

  • Funny you should say "I have no php file in this project.", your words, but accepted the question that eliminates in Ingluist the files . php, ie there actually are files . php, I was going to answer, but I avoided the simple fact that they can be files with "raw extensions" in php like .phtml or .php3, ai if I answer could work or not, do what I said in the other comment, click the blue ball next to "PHP" and see the files that appear and take a print.

  • @hugocsl the question is about LINGUIST and not about PHP running on githubpages, so much so that he didn’t mention anything about running PHP, but rather about Linguist not working as expected when used on automatic.

Show 4 more comments

2 answers

5

Github uses the library Linguist to determine the percentage of each language in a project and generate that way bar up there, however, it is not fault free.

The quickest method to solve this is to create a file called .gitattributes at the root of your directory and there put the following lines:

* linguist-vendored
*.php linguist-vendored=false

So it will ignore the type files .php. In theory it is to fix to work retroactively already in the commit of this file, but if it doesn’t work you can delete and create a new project with this file already by default.

You can also tell which language you want it to point to as the one in the project:

*.python linguist-detectable=true

Don’t forget to go to library entry and open up a solution to your problem.

  • Okay, this solves, but clearly what the author stated then is not true, because if it is necessary the false for *.php then it means that yes. PHP files, which is why no one has answered so far, because he said exactly this: Does anyone know how and why Github made this choice? I don’t have any php files in this project., and could be another extension that would have caused the problem, some extension coincidentally "php prima", like . php3 or phtml.

  • @Guilhermenascimento really don’t exist. php files in the... repository The whole project is in python itself...

  • @Viniciusbussola but no matter, the problem is that it has some extension "prima" that is not actually PHP but this confusing, the repository is PUBLIC or private? Surely there is something wrong, do the following, click the blue ball next to "PHP", it will display the files that caused this in Languist.

  • @Guilhermenascimento The repository is private unfortunately.. The blue ball is not clickable tb.. Once I find out what caused it I share here

3


I found out what it was.
First, as @Guilhermenascimento had already warned in some comment, my question is wrong as I discovered that inside my file Static there are yes 2 files. php.

  • So yes, there are files .php in my project (Although there are only 2);
  • The @Max response unfortunately didn’t work, I don’t know why;

Completion of my tests with the file .gitattributes:

  • Just putting * Linguist-vendored the github withdrawing language information, leaving this field blank;
  • I had to disregard my briefcase Static, where there were 2 files .php;
  • Since the project was developed in Django, I had to disregard the folders of my templates, so that github does not understand the project as being .html

My file .gitattributes was like this:

static/* linguist-vendored
site_cartao/static/* linguist-vendored
site_cartao/templates/* linguist-vendored


And the result:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.