相关疑难解决方法(0)

将更改推送到远程存储库时,此Git警告消息是什么?

描述有点简洁.我只是在我的本地主分支上添加了一个文件并将其推回到远程仓库.知道为什么会这样吗?

warning: updating the current branch
warning: Updating the currently checked out branch may cause confusion,
warning: as the index and work tree do not reflect changes that are in HEAD.
warning: As a result, you may see the changes you just pushed into it
warning: reverted when you run 'git diff' over there, and you may want
warning: to run 'git reset --hard' before starting to work to recover.
warning: 
warning: You can set 'receive.denyCurrentBranch' configuration variable to
warning: …

git version-control

58
推荐指数
3
解决办法
3万
查看次数

Git不会克隆后续克隆上的所有分支?

我使用克隆的存储库和分支在Git上遇到了一些问题,但我不可能找到答案.让我来描述一下:我们在这里有一个简单的主Git存储库,我们都可以从这里下载并推送到位于本地linux机器上并可通过ssh访问.我把这个克隆到我的usb拇指驱动器上,如下所示:

git clone ssh://adahl@gollum//net/repos/netcube/patches.git
Run Code Online (Sandbox Code Playgroud)

这给了我一个本地克隆,在我的拇指驱动器上有一个工作副本.我cd到这个,然后在这个克隆中看到一些分支:

cd patches
git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/stable
Run Code Online (Sandbox Code Playgroud)

到目前为止一切都那么好,但是如果我在我的拇指驱动器上克隆存储库另一次到我的笔记本,稳定分支就会丢失.看到:

cd ..
git clone patches patches2

cd patches2

git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

我在克隆或克隆git fetch后尝试了几个选项,没有任何东西将stable分支带到patches2存储库.我假设我在这里缺乏理解git并且只是以错误的方式使用它.有人可以指点我的使用和/或理解错误吗?

git branch clone

6
推荐指数
2
解决办法
1万
查看次数

推送到远程服务器和Github

简介:我想在本地编辑文件,然后推送到Github和我的Web服务器.

我有两个遥控器设置没有问题,所以现在我有能力做到这一点; 但是,我必须在本地检出分支A,在服务器上检查分支B. 然后我必须SSH到服务器并检查分支A(我想要的那个).我甚至不想要或不需要第二个分支,但很多帖子表明你不能或不应该推送到非裸存储库.肯定有更好的办法.即使只使用rsync也会比这更容易(我做了一段时间).

奇怪的是,这绝不会发生在Github上.几乎所有我的回购只有一个分支,我从来没有得到这个警告.

警告消息说你可以设置receive.denyCurrentBranch为忽略,但我不知道它是多么安全/健全.我希望有人能理解我模糊的描述(这是由于我对git的了解有限)并且知道最佳解决方案.

git

5
推荐指数
1
解决办法
1809
查看次数

标签 统计

git ×3

branch ×1

clone ×1

version-control ×1