问题
I had creating git repository Test on git and installed git on my windows machine and
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
Running after comming what errors are coming .
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
how my readme file will be commited and i can see that file https://github.com/rahul23134/Test here in browser in listing of files.
Please suggest what should be do.
and Please also suggest the basic step to learn the git .
回答1:
Well first of all you didnt commit anything:
0 files changed, 0 insertions(+), 0 deletions(-)
Dont forget to first add your files before commiting:
git add README
Second problem, it looks like you don't have permissions to push to our repository, what most likely means you didn't put correctly in place your keys, check this guide for generating your keys with github
http://help.github.com/linux-key-setup/
回答2:
Please read this, I think it should help:
http://help.github.com/msysgit-key-setup/
Or this URL: http://help.github.com/troubleshooting-ssh/ (Permission denied (publickey))
Which is the exact same error you have.
回答3:
I learned it by following this guide http://www.kernel.org/pub/software/scm/git/docs/everyday.html and when done and as reference http://git-scm.com/
回答4:
You need to add files before you can commit them. That's your first mistake.
Secondly, your ssh credentials are not uploaded on Github so it doesn't know who you are when you try to push. Since you're using github, the details are here for Gnu/Linux and here for Windows.
As for learning the basics, the best documentation I've found are the progit book, git community book and the git reference card.
If you're in India, I conduct public trainings on git which you can register for and attend. The details are on my website linked to from my Profile.
来源:https://stackoverflow.com/questions/5026796/git-repositiory-adding-files