将 GIT 本地重置为远程版本
Resetting GIT local to remote version
我正在尝试重置我的 Git,因为我遇到了各种问题。它不允许我将几个大文件推送到我的远程,我不知道如何从提交中删除它们。我什至不记得提交文件了。
我的遥控器是:pmp_staging
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 遥控器与我的本地遥控器匹配,这样我就可以开始练习推送和提交。我在堆栈溢出上寻找的一切似乎都不起作用。
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>...]'
谢谢!
根据您的说法,git reset --hard pmp_staging/master
应该可以工作,除非 pmp_staging 上没有主分支,这很奇怪。
运行 git branch -a
仔细检查 pmp_staging/master
是否存在。
我用rm -rf .git
删除了我的整个 git 存储库。
我不得不重新启动并按照 WPengine's GIT Page
中的说明进行操作
我最初使用 Git Hub's 帮助为 WPengine.com 设置了 SSH。这使我能够获取我的 SSH 密钥并将其输入到我在 WPengine.com.
上的安装中
之后,我必须仔细按照说明进行操作。我下载了压缩安装并粘贴到我的本地 WAMP 文件夹中。登录 GIT Bash 并在我的 /c/wamp64/www/my_install/ 文件夹下设置 SSH。
我必须下载并设置 .gitignore 文件,该文件允许 Wordpress 核心更改,因为我们实际上已经为面向对象的编程编辑了其中一些文件。
然后我简单地遵循了 WPengine 的协议:
$ cd ~/wordpress/my_wp_install_name
$ git init .
$ git add . --all
$ git commit -m "initial commit..."
我一定是一开始忘记了'add . --all'。
将我的安装设置为远程到我的登台:
$ cd /c/wamp64/www/my_install
$ git remote add staging git@git.wpengine.com:staging/my_install.git
然后我部署到我的远程:
$ git push staging master
到目前为止 GIT 一直在工作,直到我下次搞砸为止。
我正在尝试重置我的 Git,因为我遇到了各种问题。它不允许我将几个大文件推送到我的远程,我不知道如何从提交中删除它们。我什至不记得提交文件了。
我的遥控器是:pmp_staging
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 遥控器与我的本地遥控器匹配,这样我就可以开始练习推送和提交。我在堆栈溢出上寻找的一切似乎都不起作用。
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>...]'
谢谢!
根据您的说法,git reset --hard pmp_staging/master
应该可以工作,除非 pmp_staging 上没有主分支,这很奇怪。
运行 git branch -a
仔细检查 pmp_staging/master
是否存在。
我用rm -rf .git
删除了我的整个 git 存储库。
我不得不重新启动并按照 WPengine's GIT Page
中的说明进行操作我最初使用 Git Hub's 帮助为 WPengine.com 设置了 SSH。这使我能够获取我的 SSH 密钥并将其输入到我在 WPengine.com.
上的安装中之后,我必须仔细按照说明进行操作。我下载了压缩安装并粘贴到我的本地 WAMP 文件夹中。登录 GIT Bash 并在我的 /c/wamp64/www/my_install/ 文件夹下设置 SSH。
我必须下载并设置 .gitignore 文件,该文件允许 Wordpress 核心更改,因为我们实际上已经为面向对象的编程编辑了其中一些文件。
然后我简单地遵循了 WPengine 的协议:
$ cd ~/wordpress/my_wp_install_name
$ git init .
$ git add . --all
$ git commit -m "initial commit..."
我一定是一开始忘记了'add . --all'。
将我的安装设置为远程到我的登台:
$ cd /c/wamp64/www/my_install
$ git remote add staging git@git.wpengine.com:staging/my_install.git
然后我部署到我的远程:
$ git push staging master
到目前为止 GIT 一直在工作,直到我下次搞砸为止。