• 本地上传代码文件到github的一些问题处理


            创建新的空仓库之后,提交本地文件到git仓库,当然在浏览器界面上传等都可以,方法不是一种,这里介绍我们在本地进行一些git bash的命令操作,然后遇到的一些问题。

    具体的步骤,在创建一个新仓库的时候,就会有提示如何操作,如下图:


    创建新的仓库(右键目录点击 git bash here)

    1. echo "# WGAN的修改版本" >> README.md
    2. git init
    3. git add README.md
    4. git commit -m "first commit"
    5. git branch -M main
    6. git remote add origin https://github.com/yihangzhao/NewWGAN.git
    7. git push -u origin main

    对于新手,对上面的命令做个解释:

    echo "# WGAN的修改版本" >> README.md
    生成一个README.md文件,内容就是echo的东西,当然更详细的内容可以自己编辑,md是markdown标记文件,根据规则可以输入不同大小的文字、链接、代码高亮等等

    git init
    生成.git文件目录,里面是一些配置文件与其他目录与文件

    git commit -m "first commit"
    出错信息:

    Tony@TonyComputer MINGW64 ~/Downloads/NewWGAN (master)
    $ git commit -m "first commit"
    Author identity unknown

    *** Please tell me who you are.

    Run

      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"

    to set your account's default identity.
    Omit --global to set the identity only in this repository.

    fatal: unable to auto-detect email address (got 'Tony@TonyComputer.(none)')

    需配置邮箱和用户名
    git config --global user.email "xx@xxx.com"
    git config --global user.name "xxx"

    git push -u origin main
    Select an authentication method for 'https://github.com/':
      1. Web browser (default)
      2. Personal access token
    option (enter for default):1

    选1,然后将弹出需要输入用户名和生成的pat密钥的弹出框,分别输入之后就OK了

    Enumerating objects: 3, done.
    Counting objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 293 bytes | 146.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
    To https://github.com/yihangzhao/NewWGAN.git
     * [new branch]      main -> main
    Branch 'main' set up to track remote branch 'main' from 'origin'.

    git add README.md
    添加介绍文件,这个项目的一些主要介绍

    git commit -m "first commit"
    第一次提交

    git branch -M main
    git remote add origin https://github.com/yihangzhao/NewWGAN.git
    git push -u origin main

    远程连接git仓库然后提交本地代码文件到主分支

    其中生成pat秘钥的步骤:Settings-->Developer settings-->Personal access tokens

    上传更新过的代码文件

    1. git add . 
    2. git commit -m "message"
    3. git push

    这样就把修改过的与新增的目录与文件都上传到了github的仓库了

    最后有兴趣的可以克隆来玩下,一个GAN的改良版本:
    git clone https://github.com/yihangzhao/NewWGAN.git
    WGAN(Wasserstein生成对抗网络)源码的讲解 也有介绍 

  • 相关阅读:
    MySQL 视图(详解)
    SpringTask任务调度和声明式事务配置
    MMORPG网络游戏开发之Protobuf的基本使用
    手写call
    Docker技术入门| Part02:Docker基础用法(Docker镜像使用、操作容器、数据管理)
    设计模式-中介者模式-笔记
    Java学习笔记(十六)
    Gitlab 中 Github import 功能存在远程代码执行漏洞
    通义灵码牵手阿里云函数计算 FC ,打造智能编码新体验
    数学建模学习(101):车辆路线规划问题
  • 原文地址:https://blog.csdn.net/weixin_41896770/article/details/127439917