【问题标题】:Another Error Pushing my Repository to Github将我的存储库推送到 Github 的另一个错误
【发布时间】:2012-06-10 22:53:06
【问题描述】:

当我进入终端时:

Parkers-MacBook-Pro:first_app ppreyer$ git remote add origin git@github.com:ppreyer/first_app.git
Parkers-MacBook-Pro:first_app ppreyer$ git push origin master

我收到以下错误:

error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:ppreyer/first_app.git'

任何帮助将不胜感激。

于是我返回并在终端中输入以下内容并得到另一个错误:

Parkers-MacBook-Pro:first_app ppreyer$ git init
Reinitialized existing Git repository in /Users/ppreyer/.ssh/first_app/first_app/.git/
Parkers-MacBook-Pro:first_app ppreyer$ git add .
Parkers-MacBook-Pro:first_app ppreyer$ git commit -m
error: switch `m' requires a value
usage: git commit [options] [--] <filepattern>...

    -q, --quiet           suppress summary after successful commit
    -v, --verbose         show diff in commit message template

Commit message options
    -F, --file <file>     read message from file
    --author <author>     override author for commit
    --date <date>         override date for commit
    -m, --message <message>
                          commit message
    -c, --reedit-message <commit>
                          reuse and edit message from specified commit
    -C, --reuse-message <commit>
                          reuse message from specified commit
    --fixup <commit>      use autosquash formatted message to fixup specified commit
    --squash <commit>     use autosquash formatted message to squash specified commit
    --reset-author        the commit is authored by me now (used with -C-c/--amend)
    -s, --signoff         add Signed-off-by:
    -t, --template <file>
                          use specified template file
    -e, --edit            force edit of commit
    --cleanup <default>   how to strip spaces and #comments from message
    --status              include status in commit message template

Commit contents options
    -a, --all             commit all changed files
    -i, --include         add specified files to index for commit
    --interactive         interactively add files
    -o, --only            commit only specified files
    -n, --no-verify       bypass pre-commit hook
    --dry-run             show what would be committed
    --short               show status concisely
    --branch              show branch information
    --porcelain           machine-readable output
    -z, --null            terminate entries with NUL
    --amend               amend previous commit
    --no-post-rewrite     bypass post-rewrite hook
    -u, --untracked-files[=<mode>]
                          show untracked files, optional modes: all, normal, no. (Default: all)

error: switch `m' requires a value 是什么意思?

【问题讨论】:

  • 那里是否存在存储库?
  • 你当前的分支叫master吗?
  • 您实际上是否向本地存储库提交了任何内容?如果没有初始提交,就没有 master 分支。

标签: ruby-on-rails git github terminal


【解决方案1】:

您的遥控器似乎没有 master 分支(您可能刚刚创建它并且它是空的?)

使用以下方法之一创建主分支:

git push -u origin master

git push origin master:master

【讨论】:

    【解决方案2】:

    错误表示你忘记在“commit”命令后添加提交信息。

    正确用法是:

    $ git commit -m "Initial Commit"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-25
      • 1970-01-01
      • 2015-08-04
      • 2021-06-11
      • 2023-03-13
      • 2021-01-08
      • 1970-01-01
      • 2019-06-18
      相关资源
      最近更新 更多