简体   繁体   中英

Another Error Pushing my Repository to Github

When I enter into the terminal:

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

I get the following error:

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

Any help would be greatly appreciated.

So I went back and entered the following into the terminal and got another error:

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)

What does error: switch `m' requires a value mean?

It looks like your remote doesn't have a master branch (you probably just created it and it is empty?)

Use one of the following to create the master branch:

git push -u origin master

or

git push origin master:master

The error means that you forgot to add a commit message after the "commit" command.

Correct usage is:

$ git commit -m "Initial Commit"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM