现有 git(私人远程)存储库已存在。无法与以前的开发人员取得联系
Existing git (private remote) repo already exists. No way of getting in contact with previous developer
想象一下。你刚得到一份新的副业。您被授予对应用程序的根访问权限。你 ssh 进入服务器。你执行了一个:
git status
你看:
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .htaccess
modified: office/.htaccess
modified: office/error_log
modified: office/wp-admin/error_log
modified: template/default/javascript.js
modified: www2/.htaccess
Untracked files:
(use "git add <file>..." to include in what will be committed)
public_html/
no changes added to commit (use "git add" and/or "git commit -a")
“好吧”你自己想。然后你 运行 a:
git config --list
你看
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:somecoolguy/somecoolproject.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
然后您访问 github 并检查 somecoolguy 的 项目并注意到它是私有的。
您想将存储库转移到另一个 git 远程位置,维护历史记录,并且不丢失任何未提交的更改,以便您可以开始处理此项目并拥有您的完全所有权自己的回购向前发展...
你是做什么的?
即使 somecoolguy 在 Github 中的帐户是私有的,您在服务器中拥有 git 存储库的完整副本(您的分支是最新的 'origin/master')。您应该能够在您帐户下的 Github 中创建一个新存储库,并将其添加为另一个 remote
,您可以在其中推送 git 历史记录。
git remote add anotherorigin git@github.com:myaccount/somecoolproject.git
请注意,此遥控器指向的是您的帐户,而不是某个酷人的帐户。
如果您不想使用 SSH 密钥(因为服务器中的密钥可能属于某个酷人),您可以 link 使用 https 的新来源,这将需要您的 Github 推送时的凭据:
git remote add anotherorigin https://github.com/myaccount/somecoolproject.git
完成后,将您的存储库推送到新的远程服务器就足够了。如果你不想丢失尚未提交的更改,你可以在推送之前随时提交未提交的文件:
git add .
git commit -m "New commit"
git push anotherorigin master
想象一下。你刚得到一份新的副业。您被授予对应用程序的根访问权限。你 ssh 进入服务器。你执行了一个:
git status
你看:
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .htaccess
modified: office/.htaccess
modified: office/error_log
modified: office/wp-admin/error_log
modified: template/default/javascript.js
modified: www2/.htaccess
Untracked files:
(use "git add <file>..." to include in what will be committed)
public_html/
no changes added to commit (use "git add" and/or "git commit -a")
“好吧”你自己想。然后你 运行 a:
git config --list
你看
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:somecoolguy/somecoolproject.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
然后您访问 github 并检查 somecoolguy 的 项目并注意到它是私有的。
您想将存储库转移到另一个 git 远程位置,维护历史记录,并且不丢失任何未提交的更改,以便您可以开始处理此项目并拥有您的完全所有权自己的回购向前发展...
你是做什么的?
即使 somecoolguy 在 Github 中的帐户是私有的,您在服务器中拥有 git 存储库的完整副本(您的分支是最新的 'origin/master')。您应该能够在您帐户下的 Github 中创建一个新存储库,并将其添加为另一个 remote
,您可以在其中推送 git 历史记录。
git remote add anotherorigin git@github.com:myaccount/somecoolproject.git
请注意,此遥控器指向的是您的帐户,而不是某个酷人的帐户。
如果您不想使用 SSH 密钥(因为服务器中的密钥可能属于某个酷人),您可以 link 使用 https 的新来源,这将需要您的 Github 推送时的凭据:
git remote add anotherorigin https://github.com/myaccount/somecoolproject.git
完成后,将您的存储库推送到新的远程服务器就足够了。如果你不想丢失尚未提交的更改,你可以在推送之前随时提交未提交的文件:
git add .
git commit -m "New commit"
git push anotherorigin master