重命名 repo 后更新 .git 文件的过程是什么?
What is the process to update .git files after renaming repo?
我在 BitBucket 上重命名了存储库,然后在尝试再次推送时出现错误。我重命名了一个 repo,现在看到:
cchilders:~/projects/gitflow_automation (master)
$ showorigin
repository does not exist.
fatal: Could not read from remote repository.
我也是
$ rm -rf .git
$ git init
$ git remote add origin git@bitbucket.org:codyc54321/gitflow_automation.git
这会将新命名的存储库(虽然是同一个存储库,只是新名称)添加到新的 .git
文件中。
然后我做了
cchilders:~/projects/gitflow_automation
$ showorigin
* remote origin
Fetch URL: git@bitbucket.org:codyc54321/gitflow_automation.git
Push URL: git@bitbucket.org:codyc54321/gitflow_automation.git
HEAD branch: master
Remote branch:
master new (next fetch will store in remotes/origin)
cchilders:~/projects/gitflow_automation
$ git pull
remote: Counting objects: 70, done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 70 (delta 20), reused 0 (delta 0)
Unpacking objects: 100% (70/70), done.
From bitbucket.org:codyc54321/gitflow_automation
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
cchilders:~/projects/gitflow_automation
$ nano FAKE
cchilders:~/projects/gitflow_automation
$ cmpushall "test new repo name working"
[master (root-commit) 7b0a190] test new repo name working
21 files changed, 601 insertions(+)
create mode 100644 .gitignore
create mode 100644 FAKE
create mode 100644 README.md
create mode 100644 __init__.py
create mode 100644 gitflow/__init__.py
create mode 100644 gitflow/client.py
create mode 100644 gitflow/config/__init__.py
create mode 100644 gitflow/github_webdriver_client/__init__.py
create mode 100644 gitflow/pivotal_tracker_webdriver_client/__init__.py
create mode 100644 gitflow/user.py
create mode 100644 gitflow/webdriver_base/__init__.py
create mode 100644 requirements.txt
create mode 100755 scripts/make_stories.py
create mode 100755 scripts/open_pull_request.py
create mode 100755 scripts/open_pull_request.sh
create mode 100644 tests/__init__.py
create mode 100644 tests/test_github_user_login_info.py
create mode 100644 tests/test_github_webdriver_client/__init__.py
create mode 100644 tests/test_github_webdriver_client/test_github_driver.py
create mode 100644 tests/test_pivotal_tracker_webdriver_client/__init__.py
create mode 100644 tests/test_pivotal_tracker_webdriver_client/test_pivotal_tracker_driver.py
To bitbucket.org:codyc54321/gitflow_automation.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@bitbucket.org:codyc54321/gitflow_automation.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
cchilders:~/projects/gitflow_automation (master)
$ git fetch
cchilders:~/projects/gitflow_automation (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
导致此问题的原因:
cchilders:~/projects/gitflow_automation (master)
$ git pull origin master
From bitbucket.org:codyc54321/gitflow_automation
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
有没有办法重命名 BitBucket 或 GitHub 上的存储库?
我不知道它是否有效,但我想你可以试试这些,
尝试git pull --rebase
看到这个link
您可以使用 --allow-unrelated-histories
强制合并发生,就像这样
git pull origin branchname --allow-unrelated-histories
希望这对您有所帮助。
丹麦语的 git pull origin master --allow-unrelated-histories
有效:
显示重新加入了一些奇怪的分离部分,我已将其重命名并删除。git
要更新本地存储库中的远程 url 运行(对于 ssh):
git remote set-url origin git@git***.com:owner/project_name.git
或对于 http(s):
git remote set-url origin https://git***.com/nh-ad/dynamic-audiance-segment.git
我在 BitBucket 上重命名了存储库,然后在尝试再次推送时出现错误。我重命名了一个 repo,现在看到:
cchilders:~/projects/gitflow_automation (master)
$ showorigin
repository does not exist.
fatal: Could not read from remote repository.
我也是
$ rm -rf .git
$ git init
$ git remote add origin git@bitbucket.org:codyc54321/gitflow_automation.git
这会将新命名的存储库(虽然是同一个存储库,只是新名称)添加到新的 .git
文件中。
然后我做了
cchilders:~/projects/gitflow_automation
$ showorigin
* remote origin
Fetch URL: git@bitbucket.org:codyc54321/gitflow_automation.git
Push URL: git@bitbucket.org:codyc54321/gitflow_automation.git
HEAD branch: master
Remote branch:
master new (next fetch will store in remotes/origin)
cchilders:~/projects/gitflow_automation
$ git pull
remote: Counting objects: 70, done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 70 (delta 20), reused 0 (delta 0)
Unpacking objects: 100% (70/70), done.
From bitbucket.org:codyc54321/gitflow_automation
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
cchilders:~/projects/gitflow_automation
$ nano FAKE
cchilders:~/projects/gitflow_automation
$ cmpushall "test new repo name working"
[master (root-commit) 7b0a190] test new repo name working
21 files changed, 601 insertions(+)
create mode 100644 .gitignore
create mode 100644 FAKE
create mode 100644 README.md
create mode 100644 __init__.py
create mode 100644 gitflow/__init__.py
create mode 100644 gitflow/client.py
create mode 100644 gitflow/config/__init__.py
create mode 100644 gitflow/github_webdriver_client/__init__.py
create mode 100644 gitflow/pivotal_tracker_webdriver_client/__init__.py
create mode 100644 gitflow/user.py
create mode 100644 gitflow/webdriver_base/__init__.py
create mode 100644 requirements.txt
create mode 100755 scripts/make_stories.py
create mode 100755 scripts/open_pull_request.py
create mode 100755 scripts/open_pull_request.sh
create mode 100644 tests/__init__.py
create mode 100644 tests/test_github_user_login_info.py
create mode 100644 tests/test_github_webdriver_client/__init__.py
create mode 100644 tests/test_github_webdriver_client/test_github_driver.py
create mode 100644 tests/test_pivotal_tracker_webdriver_client/__init__.py
create mode 100644 tests/test_pivotal_tracker_webdriver_client/test_pivotal_tracker_driver.py
To bitbucket.org:codyc54321/gitflow_automation.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@bitbucket.org:codyc54321/gitflow_automation.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
cchilders:~/projects/gitflow_automation (master)
$ git fetch
cchilders:~/projects/gitflow_automation (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
导致此问题的原因:
cchilders:~/projects/gitflow_automation (master)
$ git pull origin master
From bitbucket.org:codyc54321/gitflow_automation
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
有没有办法重命名 BitBucket 或 GitHub 上的存储库?
我不知道它是否有效,但我想你可以试试这些,
尝试git pull --rebase
看到这个link
您可以使用 --allow-unrelated-histories
强制合并发生,就像这样
git pull origin branchname --allow-unrelated-histories
希望这对您有所帮助。
丹麦语的 git pull origin master --allow-unrelated-histories
有效:
显示重新加入了一些奇怪的分离部分,我已将其重命名并删除。git
要更新本地存储库中的远程 url 运行(对于 ssh):
git remote set-url origin git@git***.com:owner/project_name.git
或对于 http(s):
git remote set-url origin https://git***.com/nh-ad/dynamic-audiance-segment.git