提交步骤
来源:GitHub
…or create a new repository on the command line
echo "# 1" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:×××/××.git
git push -u origin main
备注:
命令git init把这个文件夹变成Git可管理的仓库
git@github.com:×××/××.git是SSH
如果当你配置完这些还看不到GitHub上有你要上传的文件,可以参考在vscode提交代码至GitHub.详细步骤。
接着,执行指令
1、git init
2、git add *
(将代码添加到本地仓库,*是添加全部代码,代码全部更新)
3、git commit -m "first commit"
(提交到本地缓冲)
4、git remote add origin https://github.com/×××/××.git
(将本地仓库的代码提交远程github的仓库,后面的地址就是之前创建github的远程仓库地址)
5、git push -u origin main/master
(将远程仓库的代码 push到main或master分支上,想提交分支点上执行git branch -M master
)
…or push an existing repository from the command line
git remote add origin git@github.com:×××/××.git
git branch -M main
git push -u origin main
报错
(备注:部分是步骤不完善或网络问题)