您的位置:首页 > 编程语言

使用git客户端第一次git clone github.com代码的方法

2015-07-28 17:04 681 查看

使用git客户端第一次git clone github.com代码的方法

使用git-clone命令从github上同步github上的代码库时,如果使用SSH链接,而你的SSH key没有添加到github帐号设置中,系统会报下面的错误:

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

这时,需要在本地创建SSH key,然后将生成的SSH key文件内容添加到github帐号上去。创建ssh key的过程如下:

输入命令:
ssh-keygen -t rsa -c "youremail@xx.com"


然后根据提示连按三次enter键,生成的SSH key文件就保存到C:\Users\Administrator.ssh文件夹下的id_rsa.pub文件中。

如图所示:



用文本工具打开id_rsa.pub文件,复制其内容。将其粘贴到github账号下的SSH key中。

登陆自己的github账号,选择“setting”选项,添加SSH key.如图所示:





然后就可以clone自己的github上的代码了。

git clone命令:
git clone git@github.com:Jameszhjj/W3C.git


git add命令:
git add -A


git commit命令:
git commit -m " "


git push命令:
git push (origin master)
(括号内可选)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: