Git连接GitHub方式

分三步   git改名 ——> SSHkey配置 ——> git 推送命令


Git改名

                    一)  git init初始化

                    二)  git config user.name "参数1"      参数1是github账号名

                                                                   如 git config user.name "YangZhaoWeblog"

                          git config user.email "参数2"       参数2是申请github用的邮箱

                                                                   如 git config user.email "[email protected]"


SSH Key 配置

(用来识别是否有权限访问)

             一) cd ~/.ssh/  

扫描二维码关注公众号,回复: 2182652 查看本文章

                      ssh-keygen -t rsa -C    "参数3"                参数3是申请github用的邮箱        复制出现那一段文字

比如 :     

        cd ~/.ssh/

        ssh-keygen -t rsa -C  "[email protected]"

        连敲三个回车, 再用把key粘贴到github

2):登录GitHub ,Account  settings --> SSH Keys -->Add SSH Key .  Title随意,Key 粘贴


git 推送命令

     新建一个仓库,并复制地址, 注意点 use SSH 选项!!!


 
 
[email protected]:DNUI-ACM/Personal-Joe.git

https://github.com/DNUI-ACM/Personal-Joe复制仓库地址

    一) 与本地库关联

            git remote add 名字     复制来的地址

        如 git remote add STL     [email protected]:DNUI-ACM/Personal-Joe.git  

[email protected]:DNUI-ACM/Person

 SSH警告, 在第一次使用  clone 和 push 时,使用yes    

二)拉取所有github上的仓库文件(必不可少) 

            git    pull  名字  master

三)将本地库推送到远程库

          git push -u 名字 master            -u    不仅推送内容, 还推送分支

     本地提交后,即可用命令

           git push 名字 master  将本地master 分枝推送到远程库GitHub

    




猜你喜欢

转载自blog.csdn.net/pursue_my_life/article/details/81061160