I was using git on Heroku, and everything was going very good. Now I am trying to use git on a VPS server, but I can't make it work.
I am doing it on terminal over ssh. It's a rails app. When I create a new rails app, I do git init
git add .
and a commit. On the server, I create a bare repo with git init --bare
. It just fails when I try to push it.
Then I have tried to upload files to the server manually, create a repo there and clone it locally, but when I do changes locally, commit it and would upload them, it also fails.
I really did a few things more, trying to figure it out by myself what is failing. Got a lot of different errors and different ways of doing it... I read different tutorials, even my own server provider as one I followed and got errors.
When I got error messages, I've tried to find a solution, but I am not able in the end to make a push. Well, in some cases push goes well, but remote repo doesn't seems to change (and no errors after git push
).
The last 48 hours I am literally just on the computer trying to make this work, everytime starting again and trying different things.
I think for once I was just one step from doing it right. Just realized after (and can't remember steps I followed) that it could be something with using different branches, because I made that and it looked a bit strange (for me):
$ git branch -r
origin/HEAD -> origin/master
origin/master
$ git branch
* master
Strange because I think maybe there aren't listed the same remote and local branches.
So my question is really how to start a new git repo with a blank rails app, and upload everything for the first time to my server. Don't know if it matters, but I use ssh to connect to the server from terminal, server as Apache/Phusion Passenger.
I have actually all google results about this marked as visited, even most of questions on here related to my problems. So hopefully someone can tell me the right way.