yong ho
yong ho

Reputation: 4042

How to add a git repository to Ubuntu server

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?

Upvotes: 0

Views: 666

Answers (1)

ttoth
ttoth

Reputation: 76

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.

Upvotes: 2

Related Questions