"无需提交,工作目录清理"尝试提交时的消息

时间:2016-06-18 18:30:30

标签: git github

我正在尝试按照教程创建博客网站(http://tutorials.jumpstartlab.com/projects/blogger.html),但在遵循我遇到的一些错误的步骤时。我已经创建了一个空的存储库https://github.com/khpeek/jumpstart-blogger,并希望将代码从~/blogger目录推送到它。我尝试过以下命令:

kurt@kurt-ThinkPad:~/blogger$ git init
Reinitialized existing Git repository in /home/kurt/blogger/.git/
kurt@kurt-ThinkPad:~/blogger$ git add .
kurt@kurt-ThinkPad:~/blogger$ git commit -m "first blogger commit"
On branch master
nothing to commit, working directory clean
kurt@kurt-ThinkPad:~/blogger$ git remote add origin git@github.com:khpeek/jumpstart-blogger.git
fatal: remote origin already exists.

首先让我感到困惑的是"工作目录清理"警告,因为目录中有内容:

kurt@kurt-ThinkPad:~/blogger$ ls
app  config     db       Gemfile.lock  log     Rakefile     test  vendor
bin  config.ru  Gemfile  lib           public  README.rdoc  tmp

任何人都可以了解为什么我要清理工作目录"错误? (也许还有随后的"致命:远程起源已经存在"错误)?

P.S。我知道.gitignore文件在这里很重要。其内容如下:

# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp

2 个答案:

答案 0 :(得分:4)

Try cloning the repo you created on Github by executing this in your working directory:

git clone https://github.com/khpeek/jumpstart-blogger.git

Then run this:

git status

See, if your files are there and not added yet, then run:

git add .
git commit -m "First Commit"

Finally, check git status again!

Hope I helped...

答案 1 :(得分:0)

我刚开始'删除.git目录,

rm -rf .git

并重新运行命令。这很有效(我最后一步仍然需要add an SSH key for my GitHub account),虽然我不确定它为什么以前没有工作。