skip to Main Content

I have a wordpress website on hostinger and im trying use version control Git on it without downloading the files locally but i have no idea what to do or where to start ! my goal would be pushing to github as if im working locally (but im not the files are on the server and i dont want to download them ) please Help.

2

Answers


  1. Good day.
    Unfortunately you can not push at once from hostinger to Github.

    I have 7 steps for you to push all code to the GIT server:

    1)Install github locally
    Download github
    2)Copy the files of your website to local directory
    3)Open cmd.exe on windows follow to your catalog with Website files and run next command to initialize new git repository locally

    git init  
    

    4)Add files to your locall repo

    git add .  
    

    5)Add commit

    git commit -m "First commit of website"
    

    6)Create remote repo link for your website on github.com and copy link to the next command(replace CAPS)

    git remote add origin https://github.com/USERNAME/REPO_NAME.git
    

    7)Push all files to Github

    git push origin master
    
    Login or Signup to reply.
  2. You need to initiate a git repo for the files on a server and add a GitHub repo as the remote for this. Then you can push files from your Hostinger server to GitHub. To do this, you will ideally need SSH access to your hosting. This seems possible with Hostinger depending on your hosting plan. See how to login to hostinger account via SSH.

    Once you’ve logged into your hosting account via SSH:

    1. Change into your website’s folder using cd /path/to/folder
    2. Start a new git repo in this folder using git init
    3. Add all your existing files using git add .
    4. Commit the files you’ve added using git commit -m "Commit message"
    5. Create a new repo on GitHub (if you haven’t already)
    6. Add the empty GitHub repo as the remote for the files on your server using git remote add origin [email protected]:username/repo-name.git
    7. You should now be able to push files to GitHub using git push origin main or git push origin master
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search