您的位置:首页 > 编程语言

上传本地代码到GitHub远程仓库

2018-02-06 10:34 351 查看
1、在本地文件目录下,选中要提交的文件,右键点击Git Bash Here进入文件目录



2、链接远程仓库:git remote add origin git@github.com:134251796/lxy.git(远程仓库地址)
3、添加当前目录的所有文件到暂存区:git add .(点的意思是所有文件)
4、提交文件:git commit -m “描述信息”
5、上传本地分支到远程仓库:git push -u origin master
【注】如果git push报错 error:failed to push some refs to 'git@github.com:134251796/lxy.git'
 hint: Updates were rejected because the remote contains work that you do
 hint: not have locally. This is usually caused by another repository pushing
 hint: to the same ref. You may want to first integrate the remote changes
 hint: (e.g., 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原因: 
GitHub远程仓库中的README.md文件不在本地仓库中。 
解决方案:
$ git pull --rebase origin master
$ git push -u origin master
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: