Search code examples
gitgithubclonegit-pullgit-fetch

Git fetch or Git pull to update files on a web server?


I have a local repo for a project on my computer, I have pushed it to a remote github repo. I then cloned the repo to my shared webhosting server using ssh.

I have since then made some changes on my computer, which i have pushed to github and then merged to origin (master) repo.

I would like to now update these files on my web server, but I'm a little confused about the git terminology.

Git clone X

Returns

fatal: destination path '' already exists and is not an empty directory.

Do i use git pull? git fetch? I thought these commands might download the files back to my local repo on my computer instead of the webserver.


Solution

  • git clone is supposed to create the clone of remote repository on your (local) directory.

    You need to perform git pull on your webserver - that updates both the local repository and its attached working copy.

    Using git fetch would only bring changes to your local repository, without changing the local files (which are most likely the ones server by the webserver). So this is not the one.