zoukankan      html  css  js  c++  java
  • Linux 上传代码到github

    1.本地生成密钥

    ssh-keygen -t rsa -C "注册Github用的邮箱"

    生成完以后

    cd ~/.ssh 
    
    cat id_rsa.pub

    获得一串密钥

    然后拿着这一串密钥到GitHub主页 SSH and GPG keys 添加New Key

     

    Title 随便填 ,key的话就把AAAA开始到邮箱结尾全部复制

     

    2.登陆并git init 初始化

    如果之前的密钥没有问题的话,使用命令登陆:

    ssh -v git@github.com
    ssh -T git@github.com

    初始化一个git 仓库

    git init

    3.git clone / git  remote add

    git clone 一个project,远程仓库是配置好的。

    git clone https://github.com/...

     也可以自己使用命令

    git remote add origin https://github.com/frankchen121212/项目名

    4.项目完成后执行git add . 添加要上传的文件

    例:

    添加全部文件

    git add .

     添加一个文件

    git add helloworld.py

    5.提交 git commit -m "描述信息"

    例:

    git commit -m "This is the hello world code"

    6.git push 上传到 branch (默认为master)

    git push origin master

    7.报错 error:无法推送一些引用到 'https://'

    解决方法:

    强行上传

    git push -u origin +master

    而后

    git pull origin master
  • 相关阅读:
    Blue的博客
    透明状态栏和沉浸式状态栏
    Html的label和span的区别
    三个石匠的故事
    OpenSSL 生成自定义证书
    github博客配置
    js作用域其二:预解析
    数据分析常用工具总结
    堆排序
    吴裕雄--天生自然 JAVA开发学习: 循环结构
  • 原文地址:https://www.cnblogs.com/siyuan1998/p/10720420.html
Copyright © 2011-2022 走看看