首页 > Web开发 > 详细

新手使用GIT 上传文件到github

时间:2019-09-14 16:17:54      阅读:49      评论:0      收藏:0      [点我收藏+]
手把手教你如何使用 Git
    # 初始化一个新的Git仓库
    
    1.方式一: mkdir(make directory) test或者直接进入文件夹中再打开git  方式二:cd /文件夹 cd(change directory) c:/文件夹
    2.cd test(目录)
    # pwd 查看操作的目录
    # ls 查看当前的所有文件
    
    git init 进入
     
    $ git init
     
    C:/Users/10243/Desktop/mydate/.git/
      
     # 初始化后会产生一个.git 提供项目依赖配置文件
     
    $ ls -a 列出下面所有文件 包括隐藏文件
    ./  ../  .git/ 

    补充:$ ll
    total 7
    -rw-r--r-- 1 1847 197121 130  9月 13 17:33 config
    -rw-r--r-- 1 1847 197121  73  9月 13 17:33 description
    -rw-r--r-- 1 1847 197121  23  9月 13 17:33 HEAD
    drwxr-xr-x 1 1847 197121   0  9月 13 17:33 hooks/
    drwxr-xr-x 1 1847 197121   0  9月 13 17:33 info/
    drwxr-xr-x 1 1847 197121   0  9月 13 17:33 objects/
    drwxr-xr-x 1 1847 197121   0  9月 13 17:33 refs/

    
  
    
    3.git config --global user.nameAliceMye 
      git config --global user.email1024359512@qq.com 
    
    4.git status 查看git 服务状态
     # 补充 cd .. 表示从git内 回到 最外层
    
    5.把项目拖到仓库根目录优酷server4 或者 自己创建
    
    6.git add server4 这个文件 添加到git
    
   
    
    7.git commit -m你想要的文件传到git 上的文件描述
    
    
     # 将文件从暂存区 提交到 git 仓库 git 在本地 githua在线上
     # $ git status
        On branch master
        nothing to commit, working tree clean
     # 说明已经无可上传文件clean
     
      
    8.git remote add origin https://github.com/AliceMye/ttt.git
    # remote 将文件代码添加到远程的文件路径中(github远程文件)
    
    
    9.git push -u origin master
    
    # push 到远程github 仓库中 origin(起源)
    # $ git push -u origin master
    Enumerating objects: 47, done.
    Counting objects: 100% (47/47), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (44/44), done.
    Writing objects: 100% (47/47), 17.10 MiB | 1.16 MiB/s, done.
    Total 47 (delta 0), reused 0 (delta 0)
    remote: warning: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
    remote: warning: See http://git.io/iEPt8g for more information.
    remote: warning: File youku_server4/upload_movie/3a0492cf5b522850b9957ea96305bd307a6018dda151bbdcf94d0cff11a07e6b1.今日内容.mp4 is 75.65 MB; this is larger than GitHubs recommended maximum file size of 50.00 MB
    To https://github.com/AliceMye/yyy.git
     * [new branch]      master -> master
    Branch master set up to track remote branch master from origin.
    
    
    # 上传结束 提示:若要重新生成秘钥的话在git init 后去生成秘钥
    10.ssh-keygen -t rsa -C "https://github.com/AliceMye/yyy.git"
    # enter 直接过 生成秘钥
        1. /c/Users/10243/.ssh/id_rsa 找到这个文件用打开 copy 到githua ssh 秘钥中
        # $ ssh-keygen -t rsa -C "https://github.com/AliceMye/yyy.git"
        # Generating public/private rsa key pair.
        # Enter file in which to save the key (/c/Users/10243/.ssh/id_rsa):

        2.检验是否成功
            
        # 验证是否成功,在git bash里输入下面的命令
        ssh -T git@github.com  # github  # githua 命令
        ssh -T gitee@gitee.com  # gitee  # 码云的检验命令
   
    

 

新手使用GIT 上传文件到github

原文:https://www.cnblogs.com/mofujin/p/11519335.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!