• 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 上去。

     
  • 相关阅读:
    form编码方式application/x-www-form-urlencoded和multipart/form-data的区别
    CentOS开启telnet服务
    借助英语搞清会计中“借”/“贷”的含义(转载)
    乘法器的Verilog HDL实现(转载)
    Meth | 关闭mac自带apache的启动
    Meth | Git冲突:commit your changes or stash them before you can merge. 解决办法
    Meth | Git 避免重复输入用户名和密码方法
    Meth | git Please move or remove them before you can merge
    Meth | git 常用命令
    Meth | 小团队git开发模式
  • 原文地址:https://www.cnblogs.com/lhuan/p/6618178.html
Copyright © 2020-2023  润新知