我在BitBucket上重命名repos并在我尝试再次推送时出错。我重命名了一个回购,现在看到了:
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
这会将新命名的repo(同一个repo,只是新名称)添加到新的.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上重命名回购?
答案 0 :(得分:1)
我不知道它是否会起作用,但我想你可以试试这些,
尝试git pull --rebase
请参阅此link
您可以使用--allow-unrelated-histories
强制合并发生,就像这样
git pull origin branchname --allow-unrelated-histories
希望这有帮助。
答案 1 :(得分:0)
答案 2 :(得分:0)
要在本地存储库运行中更新远程URL(对于ssh):
git remote set-url origin git@git***.com:owner/project_name.git
或http://
git remote set-url origin https://git***.com/nh-ad/dynamic-audiance-segment.git