在github中创建新仓库后第一次提交gitignore

我在Github中创建了一个新的仓库,现在我只想推送gitignore文件。在下一次提交时,我想推送其余文件。

我所做的步骤-

<Page.Resources>
    <MenuFlyout x:Key="MYFLYOUT">
        <MenuFlyoutItem Text="Paste" Click="MenuFlyoutItem_Click"></MenuFlyoutItem>
    </MenuFlyout>

</Page.Resources>

<Grid>
    <RichEditBox Name="EditorBox" ContextFlyout="{StaticResource MYFLYOUT}" Paste="EditorBox_Paste" />
</Grid>

所以我将> git branch * master > git branch -r > git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: .idea/inspectionProfiles/Project_Default.xml new file: .idea/vcs.xml Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: .gitignore modified: .idea/workspace.xml .idea/workspace.xml文件夹一起放入了gitignore

.idea

我的问题是,因为远程回购中没有分支,所以将执行push命令。

我们非常感谢您的帮助。

更新-1

我尝试了以下操作-

> git add .gitignore
> git commit -m 'gitignore only'

现在,当我检查远程github时,我可以看到所有文件都已添加。

zkx993299184 回答:在github中创建新仓库后第一次提交gitignore

两个文件Project_Default.xmlvcs.xml已经处于“暂存”状态。将它们添加到.gitignore不会影响在下一个git commit中将它们集成到提交中的事实(因为它们是“暂存的”)。

我们在gitignore documentation中看到:“已经被Git跟踪的文件不受影响”

,

所以,回顾一下:

  • 您已在本地创建您的存储库并对其进行了初始化(?)
  • 您在本地分支机构master上。
  • 没有远程分支机构
  • 您已上演(git add).idea/inspectionProfiles/Project_Default.xml.idea/vcs.xml
  • 您还上演了.gitignore
  • 您只想按.gitignore

我理解正确吗?然后,您需要:

  1. 使用{li>取消.idea/inspectionProfiles/Project_Default.xml.idea/vcs.xml的登台
$ git reset .idea/inspectionProfiles/Project_Default.xml
$ git reset .idea/vcs.xml
  1. 将当前本地主服务器推送到远程存储库(假设它称为“ origin”,并在其中创建“ master”分支):
$ git push origin master
  1. 设置本地主机以跟踪远程主机:
$ git branch --set-upstream-to=origin/master master

请注意,您可以通过指定远程分支名称来执行步骤2:

$ git push origin master:remotemaster
本文链接:https://www.f2er.com/3137010.html

大家都在问