300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 使用git将代码提交到github

使用git将代码提交到github

时间:2020-04-26 04:58:27

相关推荐

使用git将代码提交到github

第一次代码提交

1.在github新建一个空白仓库

2.进入项目的文件夹打开git 命令端

右键选择git Bash here

3.

git init #初始化

4.

git remote add origin (address) # 添加远程仓库地址

5.

git add . # “.” 表示添加本地所有代码

6.

git commit -m “init” # 添加这次提交的备注信息

7.

git push origin master # 提交到远程仓库

过程中要登陆github账户,关联github账户到git

第二次提交

1.将所有变更文件添加进来

git add .

2.提交变更信息

git commit -m ‘0523_3’

3.抓取并合并远程仓库全部内容

git pull origin main

如果报错,就要挂vpn

4.推送本地仓库数据

git push origin main

将代码提交到分支

1.先在github中新建分支

2.切换到新分支

命令如下:git checkout [分支名称]

例如:git checkout dev

3.添加本地需要提交的代码

命令如下:git add .

4.提交本地代码

命令如下:git commit -m “修改说明”

5.push到git仓库

命令如下:git push origin [分支名称]

例如:git push origin dev

可能会出现的错误

报错信息

Merge branch ‘main’ of /1120026847/DataSet

Please enter a commit message to explain why this merge is necessary,

especially if it merges an updated upstream into a topic branch.

Lines starting with ‘#’ will be ignored, and an empty message aborts

the commit.

解决办法

不写原因直接3,4步骤,写原因则1,2,3,4步骤

1.按键盘字母 i 进入insert模式

2.修改最上面那行黄色合并信息,可以不修改

3.按键盘左上角"Esc"

4.输入":wq",注意是冒号+wq,按回车键即可

报错信息

fatal: unable to access ‘/1120026847/DataSet.git/’: OpenSSL SSL_connect: Connection was reset in connection to :443

解决办法

开启vpn,在项目下的git目录的命令提示符输入以下命令

git config --global http.proxy 127.0.0.1:10809git config --global https.proxy 127.0.0.1:10809

报错信息

git切换分支报错:error: pathspec ‘dev‘ did not match any file(s) known to git.

解决办法

git fetch(取回所有更新分支信息)

git branch -a(此时可以查看到dev分支)

git checkout dev

参考来源

Git 常见错误 之 error: src refspec xxx does not match any / error: failed to push some refs to 简单解决方法

【已解决】OpenSSL SSL_connect: Connection was reset in connection to :443

Git的使用–如何将本地项目上传到Github(三种简单、方便的方法)(二)(详解)

二次提交Git时操作

git出现这种错误是什么原因?error :hint?

修改文件后,使用git提交到github

【Git】合并分支出现 Please enter a commit message to explain why this merge is necessary.

怎么解决 fatal: destination path . already exists and is not an empty directory.?

Git提交本地代码至分支

git切换分支报错:error: pathspec ‘dev‘ did not match any file(s) known to git.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。