Git到Github体验

    xiaoxiao2021-03-25  83

    以AndroidStudio项目为测试

    1.安装 (官网)

    2.新建一as项目&&在github上新建一个project

    3.在命令行进入as项目路径中 git clone 网址 然后 mv github项目名/* ./

    4.命令行 

    git init 

    git add . 

    git commit -m "first commit"  

    git push origin master  (同步本地代码到github)

    坑:origin 查看方式 git remote -v 

    修改方式 删除 git remote rm origin 添加git remote add (origin) git@github.com:githubname/githubproject.git

     ! [rejected]        master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:AlvinSoong/weather.git'

    ssh -T git@github.com 测试不通过需要申请key

    ssh-keygen -t rsa -C "yourgithubname" 然后一直回车

    现在仔细看上面的反馈的消息 会有 id_rsa.pub 的位置 然后 cat 位置/id_rsa.pub 拷贝出来

    到github上 鼠标放在头像 ->settings -> ssh and GPG keys ->new sshkey ; title 随便写 下面拷贝进去

    若是push不上去 可以强制push(不推荐) git push -f origin master

    未完待续。。。

    解决方案:http://www.cnblogs.com/qcwblog/p/5709720.html

    转载请注明原文地址: https://ju.6miu.com/read-22487.html

    最新回复(0)