【问题标题】:Git pull seems to work but doesn't change anythingGit pull 似乎有效但没有改变任何东西
【发布时间】:2023-02-02 19:53:59
【问题描述】:

我尝试使用命令 pull 从 github 上的远程存储库拉取到本地目录。输出似乎是正确的,但是没有任何反应。

我的电脑是 Macbook Air M1 2020,16GB。

当我在终端上添加一个新的远程存储库时,它显然有效。我是这样做的:

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

这是输出:

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

而且,当我尝试拉动时,终端上的输出是正确的:


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


但是,在本地目录中,远程仓库中的文件不会出现。 我也试过fetchmerge,问题是一样的。他们显然工作得很好,但没有任何反应。

【问题讨论】:

  • And, when I try to pull ...您使用什么确切的命令从哪个分支中提取?

标签: git github merge fetch pull


【解决方案1】:

在这些步骤之后:

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

你有一个本地存储库没有分支. git pull 为您获取远程分支,但由于您没有本地分支,git 不知道要检出哪个远程分支。你可以手动签出一个分支,这样 git 就会显示你的文件:

git checkout master

【讨论】:

    【解决方案2】:

    听起来您只想从远程在本地创建一个新的存储库?在那种情况下,您可以发送至clone

    git clone &lt;repo&gt;.git

    【讨论】:

      猜你喜欢
      • 2020-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-25
      • 1970-01-01
      • 2018-04-25
      相关资源
      最近更新 更多