Can I get my code from my server on Github?

I used Github a few months ago, but only between my computer and Github . What I want to do now is to push the code from my server on Github . The reason for this is that I am working differently now. Currently, I save my code directly on my server provided by my hosting provider.

Can I get my code from my server on Github?

I should also mention that currently I only have FTP access to my server and use FileZilla to connect.

UPDATE

I went to the # git IRC channel and learned from some people that it is impossible to use git without SSH from one server. I contacted my host to find out if I can use SSH from the server and install git there?

+3
source share
5 answers

There are various ways to do this.

  • If you have access to your server using a command shell (or remote desktop or something else), you can simply create a git repository there.
  • If you have ftp access, you can map your ftp as a drive with something like NetDrive ( this article explains that ), and then use the same method that you usually do, but with your drive connected

, - -: script, -, - . ?

+4

-, .

, , github, GitHub.

<path-to-repo>/hooks/post-receive, :

#!/bin/sh
echo "Pushing $3 $1 to github."
git push github $3

:

chmod +x <path-to-repo>/hooks/post-receive

github :

cd <path-to-repo>
git add remote github git@github.com:<username>/<repo-name>.git

github.

+3

GitHub "public" ssh key ( ).

GitHub , ? , GitHub . , , GitHub.

, ( ), , - script , .

:

  • Clone GitHub .
  • , GitHub.
  • Git Hook, , .
  • , , .
+2

, . git... github.

+1
+1

Source: https://habr.com/ru/post/1784253/


All Articles