0

I have project on localhost and on server. There is a working version on the server and I would not like to stop working my site.

On localhost I did:

git init
git remote add origin github.....
git add .
git commit -m "first commit"
git push origin master

How to safely add GIT to the server? I have SSH.

I know I can do git clone in a separate folder etc, but I would like to do it on a working application. It is possible?

tanwe
  • 1
  • You are looking to deploy a newer version of your project without stopping the existing app? – dfundako May 22 '18 at 15:36
  • First, I would just like to connect GIT with the same version of the code as locally. Only then I want to send changes. – tanwe May 22 '18 at 15:38
  • Possible duplicate of [How do I clone into a non-empty directory?](https://stackoverflow.com/questions/2411031/how-do-i-clone-into-a-non-empty-directory) – phd May 22 '18 at 16:30

1 Answers1

0

Assuming the ssh properly has been setup properly in your server. You could just put your public key into the .ssh/authorized_keys.

As for doing git clone on running application. You also could do that. Though I would prefer to set my code repository on different server with the server that is being used to host the application.

For reference. Please read git's documentation

kucing_terbang
  • 4,991
  • 2
  • 22
  • 28