无法将现有代码推送到新的git存储库

无法将现有代码推送到新的git存储库,git,github,Git,Github,我从项目中删除了git存储库.git文件。现在,我创建了一个新的git存储库,并尝试将代码推送到新的repo中。为此,我使用了命令 git初始化 git添加 git提交-m“” git远程添加源 git-push-u源主机 对于第5点,得到的错误为 ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/xxx/project-sp.

我从项目中删除了
git
存储库
.git
文件。现在,我创建了一个新的git存储库,并尝试将代码推送到新的repo中。为此,我使用了命令

  • git初始化
  • git添加
  • git提交-m“”
  • git远程添加源
  • git-push-u源主机
  • 对于第5点,得到的错误为

     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/xxx/project-sp.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    xxxx拒绝对xxx/project-sp.git的权限。致命:无法访问“”:请求的URL 返回错误:403

    然后,我从凭证管理器中删除了git凭证,并使用命令
    git pull
    我收到的消息是

    warning: no common commits
    remote: Enumerating objects: 3, done.
    remote: Counting objects: 100% (3/3), done.
    remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
    Unpacking objects: 100% (3/3), done.
    From https://github.com/xxx/project-sp
     * [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
    

    您可以通过遵循git或bitbucket的文档来实现这一点。这是为

    工作的文档链接。我遵循了相同的步骤,但在尝试推送时遇到了错误。您是否遵循了“”处的步骤?是的,在我们使用git推送原点时,我遇到了错误。我已经更新了这个问题,请仔细研究。请按照“”中的步骤更新git配置文件中的url,并使用-f flag提交。您确定您有权访问此repo吗?您是否尝试配置RSA密钥?是的,我使用cmd
    git push
    时已登录。什么是RSA密钥我是git环境的新手。