1.创建远程仓库
1
2.创建完成,
2.png
3.cd /Users/iosdev1/Desktop/ceshi 进入项目所在文件夹
3.1
3.2
4,初始化项目 git init
4.1
4.2
5,设置本地仓库的远程仓库 git remote add origin https://github.com/fenghun777/ceshi.git
5.1
6,添加需要上传的文件(git add .) ,查看是否添加成功 (git status)
绿色字体表示成功
6.1
7,进行commit,(git commit -m "first commit")
7.1
8,推送push (git push -u origin master)
出现错误unable to access 'https://github.com/fenghun777/ceshi.git/': The requested URL returned error: 403
8
解决方案:
终端输入:vim .git/config
jjfa1
输入 i 然后
[remote "origin"] url = https://github.com/youname/example.git 为:
[remote "origin"] url = https://自己git上的名字@github.com/youname/example.git
按esc键,:wq 退出
jjfa2
再次git push -u origin master,弹出框输入密码(你在github上注册的用户名和密码),即可提交(这次没让输入密码!)
jjfa3