【发布时间】:2021-09-21 07:53:31
【问题描述】:
我没有找到任何示例显示如何在 git 中完成最简单的任务。
有人可以告诉我执行此 SVN 作业所需的 git 命令吗?
svn checkout svn://jeeves/testrepo
cd testrepo
echo >newfile.txt Wow I added a file
svn add newfile.txt
svn commit -m "How simple was that"
假设我坐在带有 git 存储库的机器上。这就是我正在做的事情(似乎还有数百种变化)。
git clone ~/git/testrepo.git
cd testrepo
echo >newfile.txt Wow I added a file
git add newfile.txt
git commit -m "So far, so good. Everything has worked so far..."
git push origin master
我不敢相信这如此困难。我显然错过了一些东西,因为我不断收到类似的消息
jeeves:~/git/myCare geoffrey$ git push origin master
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
救命!
【问题讨论】:
-
问题是
testrepo.git没有正确设置为允许推送的“服务器”存储库。相反,您已经克隆了一些已签出代码的存储库 -
您要么设置服务器存储库;或进入 testrepo 并从您的副本中提取。 stackoverflow.com/a/31590993/1505939 完整示例
标签: git