zoukankan      html  css  js  c++  java
  • github客户端上传代码

    在window下安装github客户端上传代码

    第一步:创建Github新账户

    第二步:新建仓库

    第三步:安装Github shell程序,地址:http://windows.github.com/

    第四步:打开Git Shell,输入以下命令生成密钥来验证身份

    $  ssh-keygen -C 'your@email.address' -t rsa

    连续三个回车之后会在windows当前用户目录下生成.ssh文件夹,和linux一样。

    第五步:在Git Shell下输入命令测试刚才的公钥是否认证正确。

    $ ssh -T git@github.com

    第六步:clone刚才新建的repository 到本地,输入命令:

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

    第七步:将想上传的代码目录拷贝到此文件夹下:

    第八步:切换到Git shell 命令行下,输入命令:

    git init

    git add .

    git commit -m 'xxxxxx'

    git remote add origin https://github.com/xxxxx/xxxxx.git

    git push origin master

    (1)如果执行git remote add origin https://github.com/xxxxx/xxxxx.git,出现错误:

    fatal:remote origin already exists 

    则执行以下语句:

    git remote rm origin

    再往后执行git remote add origin https://github.com/xxxxx/xxxxx.git即可。

    (2)在执行git push origin master时,报错:

    $    git push origin master
    To https://github.com/qq20707/DesignPatterns.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/qq20707/DesignPatterns.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    error:failed to push som refs to .....

    则执行以下语句:git pull --rebase origin master

    (3)如果出现错误 “refusing to merge unrelated histories”

    git pull origin master --allow-unrelated-histories

    先把远程服务器github上面的文件拉先来,再push 上去。

     
  • 相关阅读:
    ubuntu16.04下docker安装和简单使用(转)
    spring security There was an unexpected error (type=Forbidden, status=403).
    笔记42 Spring Web Flow——Demo(2)
    Idea debug时报错:Command line is too long
    特殊字符(包括emoji)梳理和UTF8编码解码原理(转)
    如何理解多租户架构?(转)
    Android Studio使用阿里云Aliyun Maven仓库
    解决 INSTALL FAILED CONFLICTING PROVIDER
    Android解决冲突
    Mysql查询库、表存储量(Size)
  • 原文地址:https://www.cnblogs.com/lhuan/p/6618178.html
Copyright © 2011-2022 走看看