0

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

krtek
  • 26,334
  • 5
  • 56
  • 84
coderwannabe2
  • 221
  • 1
  • 2
  • 12
  • 1
    Could you give some specific about the projet ? maybe also explain why you think `git` is committing all files. Your setup looks fine, so it should work, but without more information it's really difficult to say. – krtek May 12 '15 at 08:20
  • Try running `git status` before you do `git add .` and showing the output from that. Also, what is your general workflow? Are you running `vagrant destroy` between sessions and then rebuilding the boxes and syncing a folder with your project in? This might cause this to happen. – ydaetskcoR May 12 '15 at 15:13

2 Answers2

0

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!

coderwannabe2
  • 221
  • 1
  • 2
  • 12
0

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....

Alex Mulchinock
  • 2,119
  • 1
  • 18
  • 25