-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
good first issueGood for newcomersGood for newcomersquestionFurther information is requestedFurther information is requested
Description
初始化本地仓库
进入即将初始化为git仓库的根目录, 使用命令:
git init
添加远程仓库
初始化后根据你的代码编辑器的提示, 根目录下编写一个.gitignore文件, 并在其中排除一些你不想让git管理的文件
进行初次提交
配好 .gitignore
后就在本地进行初次提交
在本地添加远程仓库
使用命令:
git remote add <repo_name> <repo_URL>
一般 repo_name
取名origin, repo_URL
为项目地址, 你应该知道是什么. 命令执行后该仓库就有了远程跟踪仓库, 但是还没有远程跟踪分支
本地分支向远程分支推送
这会在本地创建一个远程跟踪分支并把代码推送上去:
git push -u <repo_name> <local_branch_name)
repo_name
是上一个步骤设置的, local_branch_name
是远程跟踪分支的父亲, 也就是你当前所在的分支(main或者master). 命令执行后, 远程跟踪分支会创建, 你的内容会被推送到github
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersquestionFurther information is requestedFurther information is requested