git存储库添加文件

时间:2011-02-17 08:54:38

标签: git git-svn

我在git上创建了git repository 测试,并在我的windows机器上安装了git并且

Global setup:

 Download and install Git
  git config --global user.name "Rahul Mehta" // i put here my name 
  git config --global user.email rahul23134654@gmail.com


Next steps:

  mkdir Test //done 
  cd Test // ..
  git init // done 
  touch README // 
  git add README // 
  git commit -m 'first commit' // running tthi give me erro 
  git remote add origin git@github.com:rahul23134/Test.git
  git push origin master

在提交错误后继续运行。

Administrator@RAHUL ~/Test (master)
$ git commit -m 'first commit'
[master (root-commit) 3787ebd] first commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README

Administrator@RAHUL ~/Test (master)
$  git remote add origin git@github.com:rahul23134/Test.git

Administrator@RAHUL ~/Test (master)
$ git push origin master
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: The remote end hung up unexpectedly

Administrator@RAHUL ~/Test (master)
$ git push origin master
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Administrator@RAHUL ~/Test (master)
$ cd existing_git_repo
sh.exe": cd: existing_git_repo: No such file or directory

我的自述文件将如何提交,我可以在浏览器的文件列表中看到该文件https://github.com/rahul23134/Test

请建议应该做什么。

并且还请建议学习git的基本步骤。

4 个答案:

答案 0 :(得分:1)

首先,你没有做任何事情:

0 files changed, 0 insertions(+), 0 deletions(-)

不要忘记在提交前先添加文件:

git add README

第二个问题,看起来您没有权限推送到我们的存储库,很可能意味着您未正确放置密钥,请查看本指南以使用github生成密钥

http://help.github.com/linux-key-setup/

答案 1 :(得分:1)

请阅读本文,我认为应该有所帮助:

http://help.github.com/msysgit-key-setup/

或此网址:http://help.github.com/troubleshooting-ssh/(权限被拒绝(公钥))

您遇到的错误完全相同。

答案 2 :(得分:0)

我按照本指南http://www.kernel.org/pub/software/scm/git/docs/everyday.html了解了这一点,完成后作为参考http://git-scm.com/

答案 3 :(得分:0)

在提交之前,您需要add个文件。那是你的第一个错误。

其次,您的ssh凭据不会上传到Github上,因此当您尝试推送时,它不知道您是谁。由于您使用的是github,因此Gnu / Linux的详细信息为here,Windows的详细信息为here

至于学习基础知识,我发现的最佳文档是progit bookgit community bookgit reference card

如果你在印度,我会对git进行公开培训,你可以注册并参加。详细信息在我的网站链接到我的个人资料。