Mac下github的使用

  1. 新建github账户

  2.  

    新建Repository,如下图:

    Mac下github的使用
  3.  

    建立连接github的秘钥

    打开mac的shell

    cd ~

    mkdir .ssh

    cd .ssh

    ssh-keygen -t rsa -C xxxxx@xxx.com(你的github账户)

    在github中添加ssh,如下图:

    Mac下github的使用
  4.  

    提交代码到github

    git config --global user.name "xxx"

    git config --global user.email "xxxxx@xxx.com"

    在你的项目目录下

    git init

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

    git add .

    git commit

    git push origin master

    END

注意事项

  • git remote add origin https://github.com/xxxxx/xxxxxx.git中得https地址就是你的github中的repository地址
  • 如果不想全部提交,可以在目录下增加一个.gitignore文件,里面写上不想add的文件或目录
 
 
原文地址:https://www.cnblogs.com/alan-babyblog/p/5150820.html