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!
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!
Related
My SVN repository contains multiple projects. Each project contains the same structure that looks like trunk -> doc -> log.txt. This log file contains the changes made between revisions.
Currently I created a php script that executes when a server build is run. This php script checks out log.txt file on the server's local directory. C://..../..../doc/log.txt.
It writes into this file and then commits the changes. The problem occurs when someone runs the server build with another project. It tried to check out the log.txt file of that project into the same directory and I get an svn error. I no longer need the checked out files in the local directory once the changes have been committed. The only option I could think of is to delete the doc folder (only in my local directory not the repo) before checking out the new one so that the previous log.txt is no longer there.
I found a recursive algorithmthat deletes all files with unlink() and directories with rmdir. The algorithm works well. Unfortunately, the hidden .svn files do not unlink() with permission denied errors. Using fileperms() on all files and parent directories gives back 16895 which translates to 40777 in octal, so I believe they have full permissions. But I believe permissions for users do not have modify/write. Is there a proper way to delete the hidden .svn folder on my server's working copy? Alternatively if anyone can think of a better method to do this. So if AprojA/doc/log.txt is already in the local directory and I check out BprojB/doc/log.txt. Is there a way to checkout and overwrite the existing log.txt with the log file from another project? --force parameter doesn't seem to do much for me.
I also had a vague idea of maybe checking out the top level svn repo with -depth=empty. and then svn update just the log txt files of each project. So instead of checkingout -> committing changes -> deleting. I can just have all log.txt files available. But the problem is they all have the same folder and file name of (doc/log.txt). Still relatively new to all this so I'd appreciate feedback of any kind.
u can use wild cards to delete the log files with the extension. so all files of the same extension will be deleted under the selected folder.
I have a repository working on git. There is a file called config.php inside a directory called site_configuration. What i want is that when someone clones the repository it should download the default configuration file, and then if someone changes and pushes the new code, it should be ignored and shouldn't be pushed to the server.
Currently in my gitignore i have this, but for some reason it still tracks the file and pushes it to the repository.
site_configuration/config.php
You can't force Git to ignore changes to a tracked file (as, in your case, the site_configuration/config.php file) in a safe way. If you want the file to be ignored, you need:
Keep the .gitignore file as you have defined
Rename the site_configuration/config.php file to site_configuration/config.php_sample
Tell everybody to copy config.php_sample to config.php. Maybe you could have some automation for that.
I AM USING VCS SOFTWARE FOR GIT.
I added a file : "Somefile" and then committed onto the server.
But following files also gets commited :
The file names that gets added to git
I checked the files added , before committing and it shows only 1 file.
I have also unticked the checkbox for any other files.
Still how does these files gets added and
how to solve this ?
It works fine when i do commit with git terminal.
These files exist in : /php/htdocs/inc/js/tiny_mce/plugins/ibrowser/scripts/phpthumb/cache
Make a .gitignore file and add
*.JPE
This will ignore any file ending in .JPE
I think, you no need to put cache files to your git remote repository.
So, the best solution to fix this issue - put cache files under git ignore.
Create .gitignore file in root directory if this file doesn't exist yet.
Add directory, which you want to ignore in .gitignore file:
/php/htdocs/inc/js/tiny_mce/plugins/ibrowser/scripts/phpthumb/cache/*.JPE
Good luck.
My GIT repository is located /var/repo/myRepo.git. I set a GIT hook post-receive* to copy the files from my repository to the folder of my project
git --work-tree=/var/www/laravel --git-dir=/var/repo/myRepo.git checkout -f
Each time I commit and push something on the server, the file var/www/laravel/config/services.php is replaced and the modification I did on the server is replaced by my local copy.
For instance, if I manually modify the following file like this on the server (by ssh session)
var/www/laravel/config/services.php
This is the modified content of this file
It will be like that after a commit and push
var/www/laravel/config/services.php
This is the default content of this file
I tried to add /config/services.php to my .gitignore but it does not seem to work.
.gitignore
/node_modules
/public/storage
/public/hot
/storage/*.key
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
/config/services.php
What should I do so this file is not replaced each time I commit something on my server ?
What should I do so this file is not replaced each time I commit something on my server?
You have only two options:
don't check it in, or
don't check it out.
Your git checkout -f command means "get me the latest commit, overwriting everything." If the latest commit has a new version of a file, that overwrites the old version of the file.
(Moreover, a .gitignore file does not mean what you think it means. It's not a list of files to ignore. It's a list of files—or name patterns—not to complain about. Usually most important, it lets you declare to Git: "Yes, I know these are in my work-tree and not in my index; don't tell me that." That's on the input side—i.e., the "don't check it in" part.)
This leads to a general rule about configurable software, where the software itself is maintained in Git, or indeed any version control system: Do not put the configuration into the version control system. The configuration is not part of the software.
Consider Git itself, for instance. You must configure Git to tell it your user.name and user.email in order to make commits with your user-name and email address. Now imagine Git came with its configuration file built into the software, that said your user name is Fred and your email is fred#fred.fred. Every time you updated Git to a new version, it would change your name back to "Fred <fred#fred.fred>". That's not very friendly, is it?
Git stores your configuration outside of the Git software. There are, to be sure, default configuration entries, but anything you set, is kept elsewhere. Updating Git does not touch this. This is not specific to Git, or even version-control systems: any system that provides upgrades must not store its configuration in a file that is destroyed by the upgrade.
So, stop doing that.
I did git rm /config/services.php and reimported the file manually. Now the file is not replaced by GIT.
I'm on a Windows machine. This seems like it should be unnecessary, but when I do it, everything suddenly works. Is there something wrong with my path? Do I need to add something to it to avoid having to copy DLLs?
Apache like any application will assume that the file is located in the same directory as the Current Directory path (check out http://en.wikipedia.org/wiki/Working_directory). If it's not there. The current working directory is USUALLY the same directory that httpd.exe (main executable) is in but it can actually be different if you do something like
C:\Apache2>bin\httpd.exe
In this case the Current Working directory is C:\Apache2 rather than C:\Apache2\bin.
If if the file isn't found there the application will naturally traverse the PATH environment variable. The PATH environment variable is a semi-colon or comma separate list of paths) to find the file.
Start -> Run -> Type "cmd.exe" and then in the Command Prompt type "echo %PATH%" to see the current path you have.
Finally, if the file wasn't found it will just error out.
As a tip you can actually track what files an application is trying to load and where they load them from by using Process Monitor. http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
I've used this tool to solve load DLL problems in Apache before and other applications as well. Just simply add a filter for the app you are running and have it only sniff out file reads.
I donot know the internals of MySQL and apache.
My thought is this. Internal of your application is using libmysql.dll. And it seems that path is not proper so it searches in PATH environmental variable. apache/bin will be there in PATH directory. So it is taking the dll from this path. If the dll is not present in that path I think it fails to load and hence fails.
EDIT: Added the solutions which were added in comments
Try rebooting your machine. I had the same issue with mysqlpp library. Path was pointing to mysql bin dir but it still couldnt find libmysql.dll – Daniel (Jan 26 at 6:55)
Apache might be running with credentials different from your own (almost certainly so if you're running it as a service.) Try placing the dirs in the SYSTEM path, not the USER path. – moocha (18 hours ago)