1

​I tried lots of times but all failed. My steps shows below

  1. add SSH key from cloud9 at my github and connect cloud 9 with my github

  2. new a repo called git@github.com:XXX/XXX.git

  3. enter the file in cloud 9

  4. git remote add origin git@github.com:XXX/XXX.git​​

  5. git push -u origin master​

Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
    To git@github.com:XXX/XXX.git​
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:XXX/XXX.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.
Can some one help me? Thanks a lot!
Patrick Haugh
  • 59,226
  • 13
  • 88
  • 96
Qiyu Zhang
  • 175
  • 1
  • 7

1 Answers1

1

This is typical of a new repo created on GitHub side non-empty (meaning with a README.md or LICENSE or...)

If you try and create a GitHub repo actually empty, you won't see that error message and won't need to do a git pull before your git push.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250