PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 15, 2022

[FIXED] Using github and MAMP

 February 15, 2022     git, gitignore, mamp, mysql, php     No comments   

Issue

I have MAMP setup on my mac, and I have a web app installed in the htdocs folder that use my mysql databases. So far everything is working great. The problem is the project is using git, so I installed the github mac app. Theres a .gitignore file that includes a bunch of files, but I'll just list one to explain my problem. This file is in in .gitignore:

/application/config/development/database.php

But, when I make changes to it, it displays in my change list. Using the github mac app, I right click and choose ignore, and it inserts this path into my .gitignore file:

application/config/development/database.php

Notice the missing '/'. But then, .gitignore shows up in my uncommitted files, and the database.php file is not ignored! Also, .gitgnore is in the .gitignore file as well. Is this a relative path problem? A git installation problem? Halp!


Solution

Usually .gitignore is commited (and pushed) like any other project relevant file. When it shows up under changed (but not staged) files, it is ok. You should commit and push it.

The fact that.gitignore contains itself makes absolutely not sense, I would recommend to remove this line.

The paths in .gitignore are relative to its location. When .gitignore is in /home/foo/bar then /herp/derp.php in .gitignore means

/home/foo/bar/herp/derp.php

whereas herp/derp.php in .gitignore will match

/home/foo/bar/herp/derp.php

as well as

/home/foo/bar/baz/herp/derp.php

The fact that the database.php shows up under changed/uncommited files means quite sure, that this file previously has been commited. You will havt to remove it from the working tree:

$ git rm /application/config/development/database.php

and commit the changes along with the changes in .gitignore.

Hope this helps!



Answered By - l-x
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing