1.创建远程仓库

2.创建完成,

3.cd /Users/iosdev1/Desktop/ceshi 进入项目所在文件夹


4,初始化项目 git init


5,设置本地仓库的远程仓库 git remote add origin https://github.com/fenghun777/ceshi.git

6,添加需要上传的文件(git add .) ,查看是否添加成功 (git status)
绿色字体表示成功

7,进行commit,(git commit -m "first commit")

8,推送push (git push -u origin master)
出现错误unable to access 'https://github.com/fenghun777/ceshi.git/': The requested URL returned error: 403

解决方案:
终端输入:vim .git/config

输入 i 然后
[remote "origin"] url = https://github.com/youname/example.git 为:
[remote "origin"] url = https://自己git上的名字@github.com/youname/example.git
按esc键,:wq 退出

再次git push -u origin master,弹出框输入密码(你在github上注册的用户名和密码),即可提交(这次没让输入密码!)

网友评论