Summary of problem solving for uploading local program operations on GitHub

1. Create a new remote warehouseinsert image description here

insert image description here

2. Submit the local program to GitHub

完整命令汇总,这些命令的顺序已解决目前Git提交所遇到的下面问题
The display part of the existing problems has not been posted, so you can go through the process in order of commands first.

    git init //把这个目录变成Git可以管理的仓库
  git checkout -b main  //切换至main默认分支
  //如果main分支已经存在执行: git checkout main
	git config --global core.autocrlf false  //提交检出均不转换
  git add .   //不但可以跟单一文件,还可以跟通配符,更可以跟目录。一个点就把当前目录下所有未追踪的文件全部add了 
  git commit -m "first commit" #把文件提交到仓库  "first commit 为仓库显示文件时后面的注释,见下图"
  git remote add origin git@github.com:Roots-Ban/project.git //关联自己的远程仓库
  git pull origin main --allow-unrelated-histories //把远程仓库和本地同步,消除main分支里文件差异,注意是`main`
  git push -u origin main  //把本地库的所有内容推送到远程库上

insert image description here
insert image description here

Solve the problem: If you are a Windows programmer and are developing a project that only runs on Windows, you can set false to cancel this function and keep the carriage return in the repository:

#提交检出均不转换
$ git config --global core.autocrlf false

insert image description here

final effect:

insert image description here

3. GitHub deletes the warehouse

https://blog.csdn.net/zzzzlei123123123/article/details/105174595
insert image description here
insert image description here

Note: Some GitHub operations (this article is a summary of these tutorial questions)

1. The GitHub upload tutorial is very detailed, but there are the following problems.
https://blog.csdn.net/ywsydwsbn/article/details/106427905#github_repository_13
2. The code submission is not in the main branch, but the master branch
https://blog.csdn.net/gongdamrgao/article/details/115032436
3 , The submitted code cannot overwrite the main file
https://www.cnblogs.com/qingheshiguang/p/14777557.html

Guess you like

Origin blog.csdn.net/m0_45057216/article/details/128127867