0

I have a node.js project local in my computer, right now, I want to push this project to remote Ubuntu server. I have create a project.git on Ubuntu server, and pushed to it. Right now, I want to run this project on the server, but how do I access this folder, it's just a git directory. The process I am following is like below:

Ubuntu server:

mkdir /home/git/project
cd /home/git/project
git init

Local computer:

git remote add origin [email protected]:/home/git/project
git add .
git commit -am "Initial Commit"
git push origin master

It push succeed. Right now, I want to execute this node.js project and run it on the server, but how to turn this git repository to a folder, so I can cd into it and then node app.js after?

1 Answer 1

2

If you want to see the code on the server side, you should init the repository without --bare option or clone it somewhere else on the server.

Bare repositories store only git specific files.

UPDATE: If you create a repository without --bare option, you can't push anything to that branch where your server is staying. Better solution is if you create a bare repository and clone it somewhere else on the server. Notice that, you should use there git pull command if you want to see your fresh code.

4
  • Just git init on the server side?
    – yong ho
    Jun 16, 2014 at 15:13
  • Yes, just a simple init without --bare option and the repository will contain your committed files.
    – ttoth
    Jun 17, 2014 at 6:41
  • Thanks, it works. But after I push some file to the master. I can't see the files on the server. But the push are success.
    – yong ho
    Jun 17, 2014 at 9:55
  • You should use git pull, but I've just rembered that you can't push anything to that branch, where you stay on a non-bare remote. So I've updated my answer with more explanation and a better soultion.
    – ttoth
    Jun 17, 2014 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.