将GIT本地版本重置为远程版本

i7uaboj4  于 2023-06-28  发布在  Git
关注(0)|答案(3)|浏览(183)

我正在尝试重置我的Git,因为我遇到了各种各样的问题。它不允许我将几个大文件推送到我的远程,我不知道如何从提交中删除它们。我甚至不记得提交文件。
我的遥控器是:PMP分级

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>

我不知道如何从原始提交中删除这些文件。我试着把头移回原点,但似乎无法摆脱它们。相反我想重新开始我只想让我的Git remote和我的local匹配,这样我就可以开始练习推送和提交了。我在堆栈溢出上寻找的所有东西似乎都不起作用。

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>...]'

谢谢!

xwbd5t1u

xwbd5t1u1#

我使用rm -rf .git删除了整个git仓库。
我不得不重新启动,并按照WPengine's GIT Page中的说明进行操作
我最初WPengine.com使用Git Hub's帮助为www.example.com设置了一个SSH。这使我能够获得我的SSH密钥,并将其输入到我在WPengine.com上的安装中。
在那之后,我不得不仔细地按照指示去做。我下载了一个压缩安装并粘贴到我的本地WAMP文件夹中。登录GIT Bash并在my /c/wamp 64/www/my_install/文件夹下设置SSH。
我不得不下载并设置.gitignore文件,它允许Wordpress核心更改,因为我们实际上已经编辑了一些面向对象编程的文件。
然后我简单地遵循WPengine的协议:

$ cd ~/wordpress/my_wp_install_name
$ git init .
$ git add . --all
$ git commit -m "initial commit..."

我一定是一开始就忘了加上。--全部。
将我的安装设置为远程到我的分段:

$ cd /c/wamp64/www/my_install
$ git remote add staging git@git.wpengine.com:staging/my_install.git

然后我部署到我的远程:

$ git push staging master

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

8nuwlpux

8nuwlpux2#

从你告诉git reset --hard pmp_staging/master应该工作,除非在pmp_staging上没有主分支,这将是奇怪的。
运行git branch -a再次检查pmp_staging/master是否存在。

rqcrx0a6

rqcrx0a63#

对于我的例子,在我的主题文件夹中有*大的*.mp4文件,这是在我迁移到wpengine后发生的,这是我使用他们的Git Push**方法推送的第一个提交。我只是按照他们在CLI中所说的那样删除了它们,重新提交并再次推送,甚至没有使用-f来强制它。

相关问题