用命令行上传本地代码到GitHub

时间:2023-03-09 21:41:42
用命令行上传本地代码到GitHub

有两种方式上传,ssh和https,ssh老是报错=。=我用的是https

先下载git   https://git-scm.com/downloads

在代码的文件夹的同级目录中邮件打开git bash here

1.在命令行中,输入“git init”;
2.输入“git add .”(不要漏了“.”),将全部内容添加到本地仓库。
3.输入“git commit -m "first commit"”(“git commit -m "提交信息"”)
4.输入“git remote add origin https://github.com/zjmgh/git1.git”(git remote add origin 你自己的https地址),连接你的guthub仓库。
5.输入“git push -u origin master”,上传项目到Github。