【发布时间】:2013-01-04 14:17:47
【问题描述】:
我的工作区中有一个 Java 项目,我正在尝试将其推送到 GitHub。
我是第一次使用 Git,还没有创建 GitHub 帐户。
这些是我遵循的步骤。
-
最初从源代码文件夹中,我做了:
git --bare init -
我再次运行
git init命令:git init -
创建了一个远程仓库:
git remote add origin ssh://ravi.kiran.com/home/sai/workspace/Sai -
然后,我将本地文件置于版本控制之下。
git add . git commit -a -m 'initialize repo'-
然后我设置我的全局配置:
git config --global user.email "ravitest@gmail.com"git config --global user.name "ravikirantest" -
git config -l的结果:sai@ravikiran:~/workspace/Sai/src$ git config -l user.email=ravitest@gmail.com user.name=ravikirantest core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.url=ssh://ravi.kiran.com remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
请告诉我如何在 GitHub 中查看我的存储库!
在这之后,我什至用上面指定的方式创建了一个 GitHub 帐户 电子邮件和用户名,但我无法在 github.com 上查看我的文件。
更新部分
sai@ravikiran:~/workspace/Sai/src$ git push origin master
Username for 'https://github.com': ravikirantest
Password for 'https://ravikirantest@github.com':
To https://github.com/ravikirantest/Chandrayan.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/ravikirantest/Chandrayan.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
sai@ravikiran:~/workspace/Sai/src$
【问题讨论】: