cod*_*321 5 git github bitbucket
我重命名了 BitBucket 上的存储库,当我尝试再次推送时出现错误。我重命名了一个存储库,现在看到:
cchilders:~/projects/gitflow_automation (master)
$ showorigin
repository does not exist.
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)
所以我这样做
$ rm -rf .git
$ git init
$ git remote add origin git@bitbucket.org:codyc54321/gitflow_automation.git
Run Code Online (Sandbox Code Playgroud)
这会将新命名的存储库(尽管是相同的存储库,只是新名称)添加到新.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
Run Code Online (Sandbox Code Playgroud)
导致这个问题的原因:
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
Run Code Online (Sandbox Code Playgroud)
有没有办法重命名 BitBucket 或 GitHub 上的存储库?
小智 12
要更新本地存储库中的远程 URL,请运行(对于 ssh):
git remote set-url origin git@git***.com:owner/project_name.git
Run Code Online (Sandbox Code Playgroud)
或对于 http(s):
git remote set-url origin https://git***.com/nh-ad/dynamic-audiance-segment.git
Run Code Online (Sandbox Code Playgroud)
我不知道它是否有效,但我想你可以尝试这些,
尝试git pull --rebase
看到这个链接
您可以使用--allow-unrelated-histories
强制合并像这样发生
git pull origin branchname --allow-unrelated-histories
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助。