github提交本地文件

1. 在github上创建项目,然后本地git init

2. git pull -f --all

3. git add .  | git commit -am "init"

4. git remote add origin [email protected]:yourName/yourRepo.git

5. git push origin master

从本地仓库提交到github远程仓库有两种方式,一种是通过ssh,另一种是https,这两种方式的本质是一样的,那就是要让远程仓库知道你是谁?,这里介绍ssh,它的优点是在每次提交的时候不需要输入用户名和密码,很方便。
首先,在bash输入以下命令来生成ssh 秘钥。
ssh-keygen -t rsa -C "[email protected]"
之后会让你确认一下秘钥的路径和密码,直接三次回车就好。然后在保存秘钥的路径下找到生成的.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。
回到github上,进入 Account Settings(账户配置),左边选择SSH Keys,Add SSH Key,title随便填,粘贴在你电脑上生成的key。


猜你喜欢

转载自blog.csdn.net/grandgrandpa/article/details/83378510