本地git仓库上传到github账户操作
zhanghe@ubuntu:~/code/python$ ssh-keygen -t rsa -C "zhang_he06@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zhanghe/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zhanghe/.ssh/id_rsa.
Your public key has been saved in /home/zhanghe/.ssh/id_rsa.pub.
The key fingerprint is:
fa:a0:f5:f5:8f:f1:17:3b:5c:8d:e4:5d:ec:b5:16:8c zhang_he06@163.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| o. |
| E.o+|
| S o +*|
| . o+=|
| + . . o +|
| o + . . + +.|
| . o o.o..|
+-----------------+
zhanghe@ubuntu:~/code/python$ gedit /home/zhanghe/.ssh/id_rsa.pub
# 复制公钥,进入https://github.com/settings/ssh
# Personal settings >> SSH keys >> add SSH key >> 粘贴保存
zhanghe@ubuntu:~/code/python$ git remote add origin git@github.com:zhanghe06/python.git
fatal: 远程 origin 已经存在。
zhanghe@ubuntu:~/code/python$ git remote rm origin
zhanghe@ubuntu:~/code/python$ git remote add origin git@github.com:zhanghe06/python.git
zhanghe@ubuntu:~/code/python$ git branch -a
* master
zhanghe@ubuntu:~/code/python$ git push -u origin master
Counting objects: 1457, done.
Compressing objects: 100% (1381/1381), done.
Writing objects: 100% (1457/1457), 9.25 MiB | 24.00 KiB/s, done.
Total 1457 (delta 225), reused 0 (delta 0)
To git@github.com:zhanghe06/python.git
* [new branch] master -> master
分支 master 设置为跟踪来自 origin 的远程分支 master。
zhanghe@ubuntu:~/code/python$ git branch -a
* master
remotes/origin/master
程序所需依赖