我已经设置了一个远程非裸"主"仓库并将其克隆到我的电脑上.我做了一些本地更改,更新了我的本地存储库,并将更改推送回我的远程仓库.到目前为止,情况还不错.
现在,我不得不改变远程仓库中的东西.然后我在当地的回购中改变了一些东西.我意识到不需要改变远程仓库.所以我尝试git push从我的本地仓库到我的远程仓库,但我收到的错误如下:
为防止您丢失历史记录,拒绝非快进更新在再次推送之前合并远程更改.有关
git push --help详细信息,请参阅"关于快进的注意事项"部分.
我以为那可能是一个
git push --force
将强制我的本地副本将更改推送到远程副本并使其相同.它确实强制更新,但当我回到远程仓库并进行提交时,我注意到文件包含过时的更改(主远程仓库以前有过).
[我]尝试强制,但当回到主服务器保存更改时,我得到过时的暂存.因此,当我提交存储库时不一样.当我再次尝试使用git push时,我得到了同样的错误.
我该如何解决这个问题?
如何将"普通"Git存储库转换为裸存储库?
主要区别似乎是:
在普通的git存储库中,您.git在存储库中有一个包含所有相关数据的文件夹,而所有其他文件都构建了您的工作副本
在一个简单的Git存储库中,没有工作副本,文件夹(让我们称之为repo.git)包含实际的存储库数据
git version-control git-clone git-bare git-non-bare-repository
我通常通过ssh(screen和vim)在远程服务器上工作,我有一个Git存储库.有时我不上网,所以我的笔记本电脑上有一个单独的存储库(从我的遥控器克隆).
但是,我无法从远程端的这个存储库中取出,因为我通常在防火墙后面,或者我没有公共IP.
我已经读过,我应该只是推到一个裸存储库.我应该如何将更改推送到远程存储库?
描述有点简洁.我只是在我的本地主分支上添加了一个文件并将其推回到远程仓库.知道为什么会这样吗?
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: …
这是我到目前为止所做的,我会说这个程序适用于Ubuntu 9.10,它可能有不同版本的git.
server: mkdir ~/git
local: scp -r /../project name@url.com:~/git/
server: cd git
        cd project
        git init 
        git add .
        git commit -a -m "initial"
local: git clone name@url.com:/../git/project /home/name/project
   cd project
   capify .  (from the ruby gem capistrano)
   git add .
   git commit -a -m "capified"
   git push
当我尝试推出时,我收到此错误消息:
   remote: error: refusing to update checked out branch: refs/heads/master
   remote: error: By default, updating the current branch in a non-bare repository
   remote: error: is denied, because it will make the …msysgit和Cygwin + git有什么区别?
现在我正在使用msysgit,但我不喜欢Git Bash(你不能调整大小或复制/粘贴)所以我在想切换到Cygwin,因为那时我可以使用mintty.
我使用以下命令设置了一个新的Git存储库:
mkdir plans-for-world-domination
cd plans-for-world-domination
git init
echo "MWA HA HA HA HA!" > plans.txt
git add .
git commit -m "Beginning my plans..."
然后我复制了这个存储库,进行了一些更改,提交了它们,然后尝试推送:
cd ..
git clone plans-for-world-domination clone
cd clone
echo "Step 1: set up super secret spy base in Cleveland, Ohio" >> plans.txt
git commit -am "Update plans"
git push origin master
当我cd回到plans-for-world-domination存储库时,staging-area/index中有一些更改与我刚刚推送的更改相反:
$ cd ../plans-for-world-domination
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD …