You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新成员更换工作站后无法向Bitbucket共享仓库推送Git提交

Fixing "Cannot push commits from other users" Git Error

Hey folks, let's tackle this Git push error your team member is facing! That policy block usually boils down to mismatched user credentials or commit author info on the new workstation—super common when switching machines. Here's how to fix it:

1. Check & Correct Git User Configuration

First up, confirm what user details Git is using on the new machine. Run this in the repo directory:

git config --list | grep user

Look for user.name and user.email—these need to match exactly the credentials that worked on their old workstation (the ones linked to your team's repo permissions).

If they're wrong, set the global config (applies to all repos on the machine):

git config --global user.name "Their Full Name"
git config --global user.email "their-work-email@company.com"

If only this repo needs a specific config, skip the --global flag and run the commands inside the repo folder.

2. Fix Existing Commits with Incorrect Author Info

If they already made commits using the wrong user info, the repo policy will flag those as "other users' commits." To fix this:

  1. Figure out how many recent commits need updating. For example, to edit the last 2 commits:
git rebase -i HEAD~2
  1. In the text editor that pops up, change pick to edit next to each commit that needs fixing. Save and close the editor.
  2. For each commit that comes up for editing, run this to update the author:
git commit --amend --author="Their Full Name <their-work-email@company.com>" --no-edit
  1. Move to the next commit with:
git rebase --continue

Repeat steps 3-4 until all problematic commits are fixed.

3. Verify Authentication Setup

Double-check that the new workstation is properly authenticated to the repo:

  • SSH: Make sure the new workstation's SSH public key is added to their account on your Git platform (like GitLab/GitHub). If they don't have a key, generate one with ssh-keygen and add the public key to their account settings.
  • HTTPS: If using HTTPS, ensure Git isn't caching someone else's credentials. Clear the cache:
    • Windows: Open Credential Manager, find entries for your Git repo, and delete them.
    • Mac: Run git credential-osxkeychain erase and follow the prompts.
    • Linux: Use git credential-cache exit to clear the cache, or adjust your credential helper settings if needed.

Once all these checks are done, have them try pushing again:

git push --set-upstream origin Branch

内容的提问来源于stack exchange,提问作者Ryan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:35:32