Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating local folder with new contents from a git repo

I cloned a git repo into my pc using this command in my git bash

git clone https://github.com/xxx/yyy.git

which created a folder called yyy in my pc.

How can I update the folder yyy in my pc with new contents of the https://github.com/xxx/yyy.git (is it called remote repo)?

I followed the instructions in Updating a local repository with changes from a Github repository, in particular git pull origin master but none of them worked and returned the error $ git pull origin master fatal: Not a git repository (or any of the parent directories): .git.

I also tried git pull https://github.com/xxx/yyy.git as I reasoned that if I successfully did git clone https://github.com/xxx/yyy.git, the git pull https://github.com/xxx/yyy.git must work otherwise git syntax is not great.

Should I do the "clone" again to overwrite the existing folder in my pc? Why can't I do "pull"?

like image 562
Nemo Avatar asked Mar 18 '19 08:03

Nemo


2 Answers

You need to issue git commands from within the cloned repository:

cd yyy
git pull
like image 107
mc1arke Avatar answered Oct 10 '22 10:10

mc1arke


You are probably executing this command from outside the yyy folder. You have to go into it first:

cd yyy
git pull
like image 34
Sam Avatar answered Oct 10 '22 09:10

Sam