Hi I am using git version 2.1.0 in my rails application . I want to ignore shell script from a folder called services
/services/*.sh
I have used this code in .gitignore , but it doesn’t works.I have called a single file directly too like
/services/setup_env_local.sh
its also not works .But other extensions like .log , .rb are ignoring with the same code
/services/*.log
what is the mistake I have done?...
Create a file in the root of the git directory called .gitignore and add the line /services/*.sh to it. This should work.
Related
So, I've came across an issue where I delete the current folder where my ruby script is executing ex:
/home/user/scriptfolder
Now i have my ruby gem running and I do this:
mycommand --deletefull
now mycommand is an GLI command, which should delete the content of the folder and the folder itself. I do that by using my custom class:
ClientModuleDir.rm_f(path)
now after deleting it I want to just do cd ..
however I've tried several methods:
system('cd ..')
Dir.chdir(dir) #dir is abs path without the scripfolder name, i've tried every combination with this command, nothing works so far.
However these methods are not working.
I still am in the
/home/user/scriptfolder
after executing these commands, but the folder DOES NOT EXIST. When I manually do cd .. and i do ls the folder is not there.
How do I change "physically" the folder in ruby code ?
The current working directory is always kept for the current program only. Changing the working directory in a program won't affect any other running programs, including its parent.
Thus, when you delete the directory in your Ruby script and change the working directory of the Ruby process one level down, this won't affect the shell process which has started your Ruby script.
I'm new to git and rails. I checked out a rails project and had a bunch of log files come in with it. I wanted to remove the log files and add an entry into .gitignore to ignore contents of the log directory. I think I screwed up because when my colleague tried to checkout from master, his log directory didn't even get generated. I think instead of ignoring contents of the log file, I ignored the entire log directory. What's the best way to change this .gitignore file to only ignore log files NOT the log directory itself? Also I don't think I need all these things in the .gitignore. What's a nice clean and simple .gitignore for a rails project?
*.sublime-*
.bundle
db/*.sqlite3*
log/*.log
*.log
tmp/**/*
tmp/*
Gemfile.lock
doc/api
doc/app
*.swp
*~
.DS_Store
Thank you in advance.
Git ignores empty folders, in fact it doesn't really know they exist (it knows about trees pointing toward file contents). Since there is no file content to point to, there is no tree and hence git will not create a folder.
Common way around this is to add empty file within the folder. Convention is to name this file .keep. Add such file to the empty folder, add it to the index, commit and push and folder will be created on checkout.
This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?
on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc
To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.
Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)
Simply rename the file you created:
C:\project> ren bowerrc .bowerrc
So I tried everything
but to no avail
I keep getting the following error
"fatal: cannot use tmp/ as an exclude file"
I have even tried using /tmp and tmp/* but none of these two work either .
Finally I deleted the tmp folder in frustration and i found that git now works perfectly
SO I have two questions.
The obvious one being . How do I get this to work?
Is it possible for me to run my ruby on rails applications without the tmp folder?
The obvious one being . How do I get this to work?
Add /tmp to your .gitignore at the root of your Rails app. Make sure you add and commit this .gitignore before committing /tmp — you'd have to git rm it to make it disappear from the repository again.
Is it possible for me to run my ruby on rails applications without the tmp folder?
No. Why would you? Rails needs to be able to write files there in order to work properly. You can only symlink it somewhere else, but that won't really solve the issue if the files are included in your repository. See also: Rails3: Change location of temp (tmp) directory
It may have to do with the way git works with cached files that the folder may still show up after including it in the .gitignore file.
Try git rm . -r --cached in the command line to clear out the cached files.
I am using Ruby on Rails, the Capistrano gem and git. Long time ago I initialized git and in the .gitignore file I stated the following:
.bundle
db/*.sqlite3
log/*.log
tmp/
One day I created a sub-directory in the /public directory of my RoR application: /public/users/.... Now in the latter directory I have the following file system structure:
/public/users/001/file1.png
/public/users/001/file2.png
/public/users/001/file3.png
...
/public/users/002/file1.png
/public/users/002/file2.png
/public/users/002/file3.png
...
...
At this time git is tracking all file in the /public directory including all directories and files inside /public/users/. So, when I deploy with Capistrano, all those will be updated on the remote machine, as well.
What I would like to do is to do not track anymore public/users directories, subdirectories and files (on my local machine) so that on the remote machine those will be not updated. That is, I would like to make possible that when I deploy with Capistrano all that is related to the public/users (on the remote machine) is untouched.
How can I do that?
P.S.: I read a lot of other questions and answers (eg: 1, 2, ...) but all them seem do not work for me.
I am almost sure that I must add the following text line to the .gitignore file:
# Ignoring "public/users/" directories, sub-directories and files
public/users/
and then (if the above code is valid) what I should do?
Try to put all user related files into one folder , say system then
You can put public/system/*.* in git ignore..
then your dir structure would be :
public
->404.html
->js.../..,..,..
->css ../..,..,..
->system
->users
->1/something
->2/something
->some-other-user-related-info
Also why is there a need to put development related files into git and then to server ?? No point .. so do not do it.. It will increase your repo size for no reason.
Since you are using capistrano your server dir structure will look like this :
APP
->Current
->releases
->shared
your public/system folder will keep pointing to shared/system
case 1: files in users/ not committed
put all the user related file in .gitignore
case 2: if files have been commited
perform a git delete and then commit
then add it to .git ignore