使用git上传代码到github

来源:互联网 发布:flotherm软件英文翻译 编辑:程序博客网 时间:2024/05/21 10:52
    一,安装git
       下载地址: https://git-scm.com/downloads,选择适用自己操作系统的git下载
        
    二,创建github账号
     1.到https://github.com/  注册账号,创建远程仓库
     
     2.生成公共秘钥
       $ ssh-keygen -t rsa -C "×××@×××.com"
       $ ssh -T git@github.com
   
     3.把第2步生成的×××.pub公钥拷贝粘贴到github上自己帐号设置里的SSH key
         
     
    三,git命令的使用 
                 
    1.$ git init
          在本地新建一个文件夹,执行git init,会在当前文件夹下创建一个.git文件夹
    
    2.$ git config --global user.emil "×××@×××.com"
       $ git config --global user.name "××××××"
        设置全局的用户信息,第二次就可以不要执行了
     
    3.$ touch text.txt
          创建一个txt文件
     
    4.$ git add  text.txt
           添加text.txt文件
           
    5. $ git commit -m "the commit message"
           提交信息

    6. $ git  remote add origin  https://github.com/×××/×××.git
          第二次就可以不要执行了
   
    7. $ git push -u  origin master
           发布到资源库
    
    8.$ git clone https://github.com/×××/×××.git
          从github资源库执下载项目,执行该命令的时候,系统会提示你输入密码。输入密码完后,系统将会下载代码到本地。

     
0 0
原创粉丝点击