• git 命令总结



    1.将仓库从服务器上克隆到本地

      打开要放置仓库的本地文件夹,右键并选择git bush,命令行输入git clone XXXX(仓库地址)

     2.将本地项目推送到服务器上(服务器上没有该仓库)

      ①首先在github上创建账户

      ②在本地项目文件夹中打开git bush,输入下面的命令行,将本地项目push到仓库  # 初始化

      git init
      # link to your github 
      git remote add origin git@github.com:githubname/repositoryname.git
      # 查看状态
      git status
      #
      git add (filesname)
      git add . (添加所有文件)   #
      #删除文件,首先在文件夹中删除,然后输入下面的命令
      git rm 文件名
      git commit
    -m"description"   # push files to your github   git push -u origin master

     3.readme

     4.配置SSH-KEY

      https://blog.csdn.net/u012702547/article/details/78954832

    5.github仓库中的文件比本地文件夹多,导致push错误! [rejected]        master -> master (fetch first) error: failed to push some refs

      解决方法:

      git pull --rebase origin master

       git push -u origin master

    6.提交代码时,设置用户名和提交邮箱(在别人的电脑上提交时,默认可能不是自己的邮箱和用户名)

    #显示当前的用户名和邮箱
    git config user.name
    git config user.email
    
    #设置全局的用户名和邮箱
    git config  --global user.name 你的目标用户名;
    git config  --global user.email 你的目标邮箱名;
    

      

  • 相关阅读:
    1014. 福尔摩斯的约会
    1009. 说反话
    1002. 写出这个数
    1031. 查验身份证
    1021. 个位数统计
    1006. 换个格式输出整数
    1058. A+B in Hogwarts
    1027. Colors in Mars
    1019. General Palindromic Number
    Windows 新装进阶操作指南
  • 原文地址:https://www.cnblogs.com/dongzhiwu/p/8761253.html
Copyright © 2020-2023  润新知