1

Running

git pull origin master 

outputs

fatal: 'origin' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly.

I've tried running

git remote add origin username@host:/var/www/public/git-test/.git
git pull origin master

and it seemed to work, but it output Already up-to-date and the file was not updated; committing and pushing from my localhost was successfull, though.

The .git files and the file I am trying to update are in the same directory and I have no bare repository, if that matters.

Why wasn't the file updated? Am I doing git remote add origin correctly? Is there a way to add this repository as local?

asyndrige
  • 572
  • 6
  • 23

2 Answers2

0

when adding a remote, don't put the ".git" directory in the url. Add you remote origin like this:

git remote add origin username@host:/var/www/public/git-test/
Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • Ok, I get it. After that and again `git pull origin master` the file on the server was still not updated. – asyndrige Dec 24 '14 at 12:16
  • if with "server" you mean your remote origin; then you need to use git push, and not git pull – Chris Maes Dec 24 '14 at 12:17
  • I edit files on my localhost, commiting and pushing them to VPS/server. The .git files editable files are in the /var/www/public/git-test/ directory. After commit and push on localhost, I need to update files on VPS. – asyndrige Dec 24 '14 at 12:26
  • you seem not to be using the correct terminology... you commit locally (on localhost). When you push, that is probably to VPS. That should work; what errors do you get. – Chris Maes Dec 24 '14 at 12:33
  • This was my previous question: http://stackoverflow.com/questions/27634489/using-git-with-localhost-and-vps. I receive no errors, the file just does not update. I get Already up-to-date and thats all. – asyndrige Dec 24 '14 at 12:38
0

Found the answer in git force push current working directory.

  • manually perform a git checkout -f to update the working dir
  • make a git post-receive hook to do it automatically.

To add local repository to git:

git add remote origin /var/www/public/git/test

Community
  • 1
  • 1
asyndrige
  • 572
  • 6
  • 23