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

使用Gitbash提交项目至GitHub失败,错误指向非目标远程仓库

Fixing Incorrect Remote Repository Configuration in Git

Hey there, it sounds like your local Git repo is linked to the wrong remote repository, which is why you're hitting that "Repository not found" error for a repo you never intended to push to. Let's walk through how to fix this step by step:

Step 1: Check Current Remote Repositories

First, let's confirm exactly which remote URLs your repo is currently using. Run this command in Git Bash:

git remote -v

This will list all remote repositories tied to your local repo—you’ll probably see that incorrect https://github.com/4bhishekKasam/Authentication-using-Passportjs.gi/ URL listed under the origin remote.

Step 2: Update the Existing Remote URL

If you want to keep using the origin name but switch its URL to your target repository, use this command (replace <correct-repo-url> with your actual repo's HTTPS or SSH URL):

git remote set-url origin <correct-repo-url>

For example, if your correct repo URL is https://github.com/your-username/your-target-repo.git, the command would look like:

git remote set-url origin https://github.com/your-username/your-target-repo.git

Step 3: (Alternative) Delete and Re-add the Remote

If you’d rather start fresh, you can remove the incorrect origin remote entirely, then add the correct one:

  • Delete the wrong remote:
    git remote remove origin
    
  • Add the correct remote (swap <correct-repo-url> with your actual repo URL):
    git remote add origin <correct-repo-url>
    

Step 4: Verify the Change

After making the update, run git remote -v again to double-check that the origin URL now points to your intended repository.

Once that’s sorted, you should be able to run git push -u origin master (or main, if your repo uses that as the default branch) without encountering the repository not found error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:37:55