How can I add git to the ruby command line? - ruby-on-rails

I am looking to access git commands from the Ruby command line in Windows 10 however when I attempt to run a git command I get a "git is not recognized" error. I can call git commands from the standard command line without any problems. I have updated my paths to include C:\Program Files\Git\cmd\ and C:\Program Files\Git\bin\ however this has not resolved the error. Any other suggestions of how to solve this?

Make sure you've set your PATH to git correctly. By default, git should already be configured to PATH automatically. Go to this link and download the correct version for your system and then install it. Afterwards, open the windows terminal and everything should work.
This may help you out: How to run Ruby and GIT commands in one place on Windows

Related

How can I run reaction-next-starterkit of reactioncommerce in Windows?

I've been trying to install and run Reaction Commerce with Reaction Plataform using Windows.
I followed all the steps, however after the make command the reaction-next-starterkit doesn't run (I checked using docker ps), and even trying make start it also doesn't work.
I checked the logs with docker-compose logs -f, and the output doesn't show me many things:
': No such file or directory'sh
reaction-next-starterkit_web_1 exited with code 127
And I tried running with other method, like this:
docker-compose up -d - inside the reaction-next-starterkit folder, but also don't keep that running.
I checked all of the containers (including the not running) and I see all of them.
Accordingly to this issue there is a config of Git in Windows that change some files when you make a git clone of any repo, in that specific case it make some projects to break.
So, the solution was to change the specific configuration:
git config --global core.autocrlf input
Then make clean to delete everything made until now, delete the cloned repository, and start from scratch.

"bash: aws: command not found" on Windows 7 in Git Bash

I'm trying to use AWS CLI to access CodeCommit. And it's sort of working. I am able to use the aws command in the Windows command prompt. However, when I try to access it using the Git Bash shell, it says
"bash: aws: command not found."
Additionally, when I try to do do a git clone in the Windows command promt, trying to access CodeCommit, it tries to use aws using the credentials helper, which also results in "aws: command not found."
I followed the instructions in the AWS documentation, which suggests some directories to add to the PATH:
https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html#awscli-install-windows-path
Here's what my PATH variable looks like:
C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\;C:\Windows\System32;;C:\Program
Files\Docker
Toolbox;C:\Users\ddrayton\MyCurl;%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts;C:\Program
Files\Amazon\AWSCLI;C:\Program Files
(x86)\Amazon\AWSCLI;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts
But I'm not sure if it's a PATH problem, since the Windows command prompt has no problem accessing the "aws" command.
Any ideas?
Fixed this by simply installing the AWS CLI again but this time using Git Bash instead of the Windows command prompt.
pip install awscli
If anyone could provide some insight as to why this was necessary, it would be appreciated.
In my case, I think a recent-to-me update to the AWS CLI changed what's run to being aws.cmd (full path C:\Program Files\Amazon\AWSCLI\bin\aws.cmd)
Git Bash needs the extension aws.cmd to make it work.
In Bash, you could try typing aws.cmd vs aws. If the former works, but not the latter, you can do alias aws='aws.cmd' in your bash startup script. I don't know if it's the best solution, but it worked for me.
FWIW, I think it's related to this:
https://unix.stackexchange.com/questions/280528/is-there-a-unix-equivalent-of-the-windows-environment-variable-pathext
On Windows 10 I was installing just once from GitBash via pip install awscli --upgrade --user as described in AWS manual for CLI installation for Linux
It installed aws executables into %USERPROFILE%\AppData\Roaming\Python\Python37\Scripts
After that just add this folder to your PATH. Re-open GitBash or cmd - it should work from both places

why does git recommits all files even the ones that I did not change

I am contributing to a project and forked their repository.
I have spent a few days on coding some new features and when I commit my changes to github every single fine gets recommited.... Even if I have not changed the file..
Why is this happening, I am new to vagrant and git.
My workflow is the following:
cd into the project:
/rails_projects/my_project
vagrant up
vagrant ssh
cd /vagrant
*****do some changes here to my code
git add .
git commit -m "asdfsdf"
git push
Is there something I missed with vagrant or git? I am on Windows running the suggested ubuntu virtual box. Maybe I had to create the virtual box in the parent directory instead of in the directory of my project? Or what is the deal? Or am i supposed to run the git commands from a different directory?
Thanks
So what ended up happening was that I had to do
cd ..
To get out of /vagrant file and then also
exit
To get out of vagrant ssh session.
Then I committed to github and everything was fine. Thanks!
To clarify for others.
It looks like you were trying to commit code from within your Vagrant box. As the OP has already found out, you don't want to do this (as the local Git repository is located on your computer, not inside the virtual machine Vagrant manages for you).
Personally, I have a terminal window open for Git and another open for Vagrant. This prevents the issue described in this question.
Bonus tip: If you develop using a Mac, you can hit Command + T whilst in Terminal to open a new tab. It's a shame you can't do this on Windows....

git doesn't work. I get "'git' is not recognized as ..."

I am trying to run this line out of http://docs.heroku.com/quickstart
git init
But I get
How do I get around this problem?
You need to install git on windows first, and then use the GIT bash shell. Here is the site for GIT on windows http://code.google.com/p/msysgit/
Just install that, open GIT Bash, navigate back to that directory and run that command again.
Make sure you did all the prerequisites on that page.
Did you install git? http://code.google.com/p/msysgit/
If so, make sure the location of the executable is in your PATH variable.
This site may help too:
http://kylecordes.com/2008/git-windows-go
i will suggest you to use tortoisegit , a git for window. But yet , develop rails in window is suffering , why don't you just dual boot your computer to linux and window ?

Heroku deployment error

In a windows environment I am getting the following error when trying to deploy to Heroku
C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/base.rb:32:in ': No such file or directory - git
remote (Errno::ENOENT)
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:in shell'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
chdir'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
cd'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:inshell'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ap
p.rb:52:in create'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:insend'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:in run_internal'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
20:inrun'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/bin/heroku:13
from C:/Ruby/bin/heroku:19:in `load'
from C:/Ruby/bin/heroku:19
Any idea how I can correct this? This is being run from the Ruby Command line (which seems to me like the regular command line)
Ok so I figured out a way to make it work and why it is likely happening.
For some reason I can only run the Ruby commands from the CMD prompt however the GIT commands only seem to work from the GIT Bash. When in the GIT Bash the Ruby commands don't work.
When you run the Heroku commands to create the service it seems to want to run certain GIT commands which don't work from the CMD prompt the way I have it set up.
To get around this for the moment I am adding the Heroku path for GIT as a remote manually and then pushing that manually when needed. An extra step but everything still works as intended.
If you need help with the work around check out the information in this link: http://www.wiki.devchix.com/index.php?title=Working_around_the_%22heroku_create%22_error
I'd still recommend using Git Bash over the normal windows CMD prompt.. but I know how tedious that can be sometimes.
You can bypass the need to do this however and get your Heroku gem working properly in your windows CMD prompt by adding your msysgit/bin path to your system Path variable.
That'll give your heroku gem access to the git command.
To add heroku as remote use the following:
git remote add heroku git#heroku.com:yourappname.git
Then push your master copy to Heroku:
git push heroku master

Resources