The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty Git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
------------------------------------------
1. 检查SSH keys是否存在
命令行:ls -al ~/.ssh
chuuchuanwenchuangdeiMac:~ developer$ ls -al ~/.ssh
total 64
drwx------ 8 developer staff 272 4 16 15:59 .
drwxr-xr-x+ 25 developer staff 850 4 15 11:47 ..
-rw-r--r--@ 1 developer staff 6148 4 16 15:59 .DS_Store
-rw------- 1 developer staff 1766 3 20 18:29 github_rsa
-rw-r--r-- 1 developer staff 404 3 20 18:29 github_rsa.pub
-rw------- 1 developer staff 1675 4 16 15:55 id_rsa
-rw-r--r--@ 1 developer staff 422 4 16 16:18 id_rsa.pub
-rw-r--r-- 1 developer staff 1199 4 15 11:47 known_hosts
如果有文件id_rsa.pub
或 id_dsa.pub,表示ssh key存在。
命令行: ssh-keygen -t rsa -C “你的邮箱(abc@.xx.com)”
chuuchuanwenchuangdeiMac:~ developer$ ssh-keygen -t rsa -C
"abc@.xx.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/developer/.ssh/id_rsa): /Users/developer/.ssh/id_rsa.pub
/Users/developer/.ssh/id_rsa.pub already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/developer/.ssh/id_rsa.pub.
Your public key has been saved in /Users/developer/.ssh/id_rsa.pub.pub.
The key fingerprint is:
通过这个命令行ssh-keygen -t rsa -C “你的邮箱(abc@.xx.com)”连接Github,生成public/private rsa key pair,提示你是否覆盖,选择y覆盖,然后提示你输入密码,最后提示你保存成功。
你可以通过/Users/developer/.ssh/id_rsa.pub.pub前往你的文件夹查看。
然后你需要下载一个可以打开pub的软件。我下载的是这个Sublime Text软件。用这个软件打开它,复制里面的内容(.pub 里的格式为:"ssh-rsa 空格 key值 空格 你的邮箱")
(1)登陆到你的Github,找到设置按钮
(2)SSH Keys -> Add SSH key
---------
直到没有报错,显示绿色的。
-------------------------------------------
现在可以使用Github for Mac客户端上传工程文件了。
--
--
--
--
这样子就提交上去了。可以在Github上自己的主页Repositories查看
--