Search code examples
gitgithubversion-controlgit-clone

How to update a Github cloned repository?


I have created a repository on Github, and the cloned from my local machine and also push some code. I cloned that repository from a virtual online machine with the repository code, the problem is that I have already cloned it once, after that, I commited some changes from my local machine and tried to clone the repo online again to add that changes to my online repo, but I got this error:

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

I don't know if there's another way to acomplish this, I'm pretty new to git and there's a lot yet to learn.


Solution

  • Use git pull instead of using git clone a second time in your virtual machine. Make sure to cd into the repo folder on the virtual machine before you pull.

    You only need to clone once. Every time after that you only need to pull new updates.