上传代码到github远端

 

本地安装完git后。在任意文件夹中右键 出现git bash 、git gui即安装成功

在已经编写的项目中 右键 ->git  bash 进入命令行:

$ git init 

上传代码到github远端

初始化git ,完了后会在当前目录下出现 .git 文件夹

上传代码到github远端

$ git add .               //  .代表选择所有文件

$ git commit -m 'first commit'                    // 双传至缓冲区, -m 后为上传注释

github远端 创建自己的仓库

1、绑定ssh  (不绑定本地和远端使用http传输,每次需要输入 用户密码; 绑定后使用ssh,可以免去用户密码 )

本地

 $ ssh-****** -t rsa -C "自己git绑定的邮箱"

c盘生成 id_rsa和id_rsa.pub :

上传代码到github远端

github远端登录后,

setting->ssh and gpg keys  ->new  ssh key

上传代码到github远端

上传代码到github远端

添加是title任意名;key 为刚刚shh上次的 id_rsa.pub的内容

上传代码到github远端d

add 后 输入github密码

添加成功后如下:

上传代码到github远端 

2、远端创建新 仓库

上传代码到github远端上传代码到github远端

复制该git连接

接着,在本地 添加绑定:

$ git remote add origin http://github.com/new 的地址/

绑定完后, 可以推自己的代码了

$ git push -u origin master    // 堆到远端 mater分支

 

查看github远端仓库:

上传代码到github远端

完成。

以后添加新代码后:

git stauts  

git add ./...          //  添加需要的代码文件

git  commit - m ' ..'         // commit 提交

git  pull oring master      // 拉取新代码 

 //  处理冲突

git push orign master      //向远端提交