github上传代码

来源:互联网 发布:mac如何重新安装系统 编辑:程序博客网 时间:2024/06/05 16:22

1注册账号,验证邮箱。

2.下载git客户端

3.ssh-keygen -t rsa -C "邮箱"

连续三个回车之后会在windows当前用户目录下生成.ssh文件夹(文件夹在win下的目录是C:\Users\用户\.ssh),和linux一样。

如果出现Bad escape character 'ygen'.说明你把ssh-keygen中间加了空格,跟我犯了同样的错误。        (逃。。。。

打开id_rsa.pub,复制里面的key。回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key。

4.配置Git

回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key。

具体如下,打开github账户设置,如图


打开ssh keys


右上角点击add ssh key


然后在title随便输入,key栏粘贴刚才的密钥。

在Git Shell下输入命令测试刚才的公钥是否认证正确。

ssh -T git@github.com

正确结果会显示:

Warning:Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.  Hi 你的用户名! You've successfully authenticated, but GitHub does not provide shell access.

接下来我们要做的就是把本地仓库传到github上去,在此之前还需要设置username和email,因为github每次commit都会记录他们。
 $ git config --global user.name "your name" 
 $  git config --global user.email "your_email@youremail.com"


上传步骤:

1.在要上传的目录下,右键git bush

命令git init,创建本地仓库,在目录下会生成一个.git文件夹

2.git add .

这个命令注意后面的那个点不要忘了,表示全部添加。如果想添加某个文件,直接换成文件名字。

3.gitcommit -m "自己填写的语句"

4.git remote add origin https://github.com/用户名/仓库名

后面的链接直接复制你仓库的url链接

5.git pull origin master

出现一个写入框,跟linux一样退出:q!

6.gitpush -u origin master就可以上传成功了











http://blog.csdn.net/fw0124/article/details/48243989
http://www.cnblogs.com/ruofengzhishang/p/3842587.html
http://blog.csdn.net/steven6977/article/details/10567719
http://blog.csdn.net/xdrt81y/article/details/21025227

0 0
原创粉丝点击