首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >重置本地到远程版本的GIT

重置本地到远程版本的GIT
EN

Stack Overflow用户
提问于 2017-03-12 11:33:35
回答 2查看 985关注 0票数 0

我想重新设置我的Git,因为我遇到了各种各样的问题。它不允许我将几个大文件推送到我的遥控器上,我也不知道如何从提交中删除它们。我甚至都不记得提交过这些文件。

我的遥控器是: pmp_staging

代码语言:javascript
运行
复制
kjlin@LAPTOP-BU6U18C6 MINGW64 /c/wamp64/www/postmyproject (master)<br>
$ git push pmp_staging master<br>
Enter passphrase for key '/c/Users/kjlin/.ssh/id_rsa':<br>
Counting objects: 7215, done.<br>
Delta compression using up to 4 threads.<br>
Compressing objects: 100% (7006/7006), done.<br>
Writing objects: 100% (7215/7215), 44.69 MiB | 1.01 MiB/s, done.<br>
Total 7215 (delta 1112), reused 0 (delta 0)<br>
remote: Resolving deltas: 100% (1112/1112), done.<br>
remote:   git.wpengine.com: validating<br>
remote:   - info: detected push to staging application ...<br>
remote:   - info: validating files in 9f1931e ...<br>
remote:   - info: found application servers ...<br>
remote:  failed...<br>
remote:   system/large file types detected:<br>
remote:   ------------------------------------------------------------------<br>
<br>
remote: wp-content/mu-plugins/wpengine-common/preamble.php<br>
remote: wp-content/mu-plugins/wpengine-common/redis-object-cache.php<br>
remote: wp-content/mu-plugins/wpengine-common/s3-uploads.php<br>
remote: wp-content/mu-plugins/wpengine-common/util.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/admin-footer.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/admin/advanced.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/admin/debug-db.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/admin/notice-sticky.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/admin/notice.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/general/powered-by.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/modal.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/staging-modal.php<br>
remote: wp-content/mu-plugins/wpengine-common/views/wpe-migration-preview-<br>template.php
remote: wp-content/mu-plugins/wpengine-common/wpe_wpdb.php<br>
remote:   ------------------------------------------------------------------
remote:   please remove these files from your source, re-commit, and push...
To git.wpengine.com:staging/postmyproject2.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to'git@git.wpengine.com:staging/postmyproject2.git'<br>

我不知道如何从原始提交中删除这些文件。我试着把头移回原点,但似乎无法摆脱它们。相反,我想重新开始。我只想要我的吉特遥控器匹配我的本地,以便我可以开始练习推送和提交。我在堆栈溢出中查找的所有内容似乎都不起作用。

代码语言:javascript
运行
复制
kjlin@LAPTOP-BU6U18C6 MINGW64 /c/wamp64/www/postmyproject (master)<br>
$ git fetch pmp_staging<br>
Enter passphrase for key '/c/Users/kjlin/.ssh/id_rsa':<br>
<br>
kjlin@LAPTOP-BU6U18C6 MINGW64 /c/wamp64/www/postmyproject (master)
$ git reset --hard master/master<br>
fatal: ambiguous argument 'master/master': unknown revision or path not in the working tree.<br>
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'<br>
<br>
kjlin@LAPTOP-BU6U18C6 MINGW64 /c/wamp64/www/postmyproject (master)<br>
$ git reset --hard pmp_staging/master<br>
fatal: ambiguous argument 'pmp_staging/master': unknown revision or path not in the working tree.<br>
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

谢谢!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-03-12 17:09:16

我使用rm -rf .git删除了我的整个git存储库。

我不得不重新启动并按照WPengine的GIT页面中的指示进行操作

我最初使用WPengine.com帮助为Git集线器设置了一个SSH。这使我能够获得我的SSH密钥并将其输入到我在WPengine.com上的安装中。

在那之后,我必须仔细地按照指示行事。我下载了一个压缩安装并粘贴到我的本地WAMP文件夹中。登录到GIT并在my /c/www 64/www/my_install/文件夹下设置SSH。

我不得不下载并设置允许Wordpress核心更改的.gitignore文件,因为我们实际上已经为面向对象编程编辑了其中的一些文件。

然后,我简单地遵循了WPengine的协议:

代码语言:javascript
运行
复制
$ cd ~/wordpress/my_wp_install_name
$ git init .
$ git add . --all
$ git commit -m "initial commit..."

我一定是忘了“加”了-全忘了。

将我的安装设置为远程到我的暂存:

代码语言:javascript
运行
复制
$ cd /c/wamp64/www/my_install
$ git remote add staging git@git.wpengine.com:staging/my_install.git

然后我部署到我的遥控器:

代码语言:javascript
运行
复制
 $ git push staging master

到目前为止,GIT一直在工作,直到我下次搞砸为止。

票数 2
EN

Stack Overflow用户

发布于 2017-03-12 15:02:38

据您所言,git reset --hard pmp_staging/master应该可以工作,除非pmp_staging上没有主分支,这将是很奇怪的。

运行git branch -a以重复检查pmp_staging/master是否存在。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42746891

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档