Home > Mobile >  Git pull seems to work but doesn't change anything
Git pull seems to work but doesn't change anything

Time:02-03

I tried to use the command pull to make a pull from a remote repository on github to a local directory. The output seems correct, however, nothing happens.

My computer is a Mac Book Air M1 2020, 16 GB.

When I add a new remote repository on terminal apparently it works. This is how I do it:

cd "local-dir-source"
git init
git remote add origin "remote-repo-source.git"
git remote -v

and this is the output:

origin  "remote-repo-source.git" (fetch)
origin  "remote-repo-source.git" (push)

And, when I try to pull, the output on terminal is correct:


remote: Enumerating objects: 93, done.
remote: Counting objects: 100% (93/93), done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 93 (delta 26), reused 74 (delta 16), pack-reused 0
Unpacking: 100% (93/93), 20.18 KiB | 148.00 KiB/s, done.
From "remote-repo-source"
 * [new branch]    master     -> origin/master
 * [new branch]    testing    -> origin/testing
There is no tracking information for the current branch.
Specify the branch you want to merge by.
See git-pull(1) for more details.

    git pull <remoto> <branch>

If you want to set tracking information for this branch you can do it with:

    git branch --set-upstream-to=origin/<branch> master


However, on the local directory, files in the remote repo do not appear. I also tried with fetch and merge, and the problem is the same. They apparently work well, but nothing happens.

CodePudding user response:

After these steps:

cd "local-dir-source"
git init
git remote add origin "remote-repo-source.git"

You have a local repository without a branch. git pull fetches remote branches for you, but since you don't have a local branch, git doesn't know which remote branch to checkout. You can manually checkout a branch so git will present your files:

git checkout master

CodePudding user response:

It sounds like you just want to create a new repository locally from a remote right? In that case you could just to a clone.

git clone <repo>.git

  • Related