Mac 中 Github 配置和使用

1、下载安装 Git for Mac

2、配置 Git

$ git config --global user.name "Your Name Here"

# Sets the default name for git to use when you commit



$ git config --global user.email "[email protected]"

# Sets the default email for git to use when you commit



$ git configuser.name 

$ git config user.email

# 在上述设置完毕后,可通过这两条命令查看自己的设置

3、创建仓库

远程:首先在 Github.com 上创建一个repository (例:Hello-World)



本地:

$ mkdir ~/Hello-World

# 在本地的~/目录下创建一个 git 仓库,目录创建在别处也可以



$ cd ~/Hello-World

# 切换至刚创建好的目录



$ git init

# 初始化一个本地的 git仓库,生成隐藏的.git目录



添加:

$ touch README

# Creates a file called "README" in your Hello-World directory

#(可以添加.txt .md .html等格式后缀),找到后可打开编辑。



$ git add README

# Stages your README file, adding it to the list of files to be committed

# 把README文件添加到仓库中



$ git commit -m 'first commit'

# Commits your files, adding the message "first commit"

# 执行提交说明



提交:

$ git remote add origin https://github.com/username/Hello-World.git

# Creates a remote named "origin" pointing at your GitHub repository

# 使用https协议指定、连接远程仓库地址



$ git push origin master

# Sends your commits in the "master" branch to GitHub

# 推送本地仓库到远程指定的master主分支上

 

你可能感兴趣的:(github)