Git 我想推到一个不是大师级的分支。我就是这么做的

Git 我想推到一个不是大师级的分支。我就是这么做的,git,Git,(第二个是分支机构的名称)但它说 git init git add . git commit -m "first" git push origin ritu git init将只创建本地存储库 您尚未定义任何指向远程副本的链接,git push将无法工作 根据您的需要: 您只想保留项目的本地历史记录:不需要使用任何远程副本,您可以忽略git push步骤 您希望与其他人共享此项目:您需要创建一个可供其他人访问的远程存储库 您的意图是在现有项目上工作:您应该从克隆此现有项目开始,并找到一些方法来

(第二个是分支机构的名称)但它说

git init
git add .
git commit -m "first"
git push origin ritu

git init
将只创建本地存储库

您尚未定义任何指向远程副本的链接,
git push
将无法工作

根据您的需要:

  • 您只想保留项目的本地历史记录:不需要使用任何远程副本,您可以忽略
    git push
    步骤

  • 您希望与其他人共享此项目:您需要创建一个可供其他人访问的远程存储库

  • 您的意图是在现有项目上工作:您应该从克隆此现有项目开始,并找到一些方法来移动此克隆上的工作


  • 通常,当您开始克隆现有存储库时,会得到一个带有远程副本的存储库,例如:

    fatal: origin does not appear to be a git repository.
    fatal: could not read from remote repository.
    Please sure you have the correct access rights and the repository exists.
    

    您必须首先添加远程分支,并且您可能还希望首先创建本地分支,因此:

    # this will create a local 'project/' repository,
    # with all the history of the remote project,
    # and, by default, git will keep the information :
    #     "'origin' is a shortcut for https://github.com/user/project"
    
    git clone https://github.com/user/project
    
    git init
    git远程添加源
    #或者,如果init+remote:git clone
    git添加。。。
    git提交
    吉特日图分行
    git推送原点ritu
    
    在将其推送到remote之前,您需要添加一个。您可以通过git remote add origin来实现这一点git@host_name:用户名/repo.git


    完成此操作后,请尝试
    git push-u origin your_分支

    git brnach的输出是什么?可能的副本您没有在任何地方设置origin。Origin是您从中克隆的原始回购协议。由于您刚刚创建了repo,因此您没有其他来源,因此无法推送@RohanSarkar的可能重复项:您希望如何使用
    git push
    命令?
    git init
    git remote add origin <url>
    
    # or, instead if init+remote:  git clone <url>
    
    git add ...
    git commit
    git branch ritu
    git push origin ritu