Use git to upload files to Github

1. First create a repository on github

2. Create a new empty folder locally and open git bash and enter the following command

 

 Direct ctrl+c the following code and then ctrl+v in git bash

echo "# upalab" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:Hu-xiao-m/upalab.git(这里输入自己仓库的网址https和ssh均可)
git push -u origin main

Then I got this error

 

Then enter the following code (the following link is replaced with ssh)

 

  Direct ctrl+c the following code and then ctrl+v in git bash

git remote add origin [email protected]:Hu-xiao-max/upalab.git(输入自己的网址)
git branch -M main
git push -u origin main

 

 Then jump out of the login interface

 

After logging in, allow 

 

 

1.把需要上传的文件拷贝到刚下载的新文件夹内

2.接下来依次输入以下代码即可完成其他剩余操作:

3.git add . (注:别忘记后面的.,此操作是把文件夹下面的文件都添加进来)

4.git commit -m “提交信息” (注:“提交信息”里面换成你需要,如“first commit”)

5.git push -u origin main (注:此操作目的是把本地仓库push到github上面,此步骤需要你输入帐号和密码)

6.OK,刷新网站页面就可以看到已经上传的文件了。

 

 

hu211@DESKTOP-MGVVROH MINGW64 /d/githubrepositories (main)
$ git add .
warning: LF will be replaced by CRLF in Project.md.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/fonts/fontawesome/fontawesome-webfont.svg.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-fontsettings/fontsettings.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-fontsettings/website.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-highlight/ebook.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-highlight/website.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-search-pro/jquery.mark.min.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-search-pro/search.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-search-pro/search.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook-plugin-sharing/buttons.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/gitbook.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/style.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gitbook/theme.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory

hu211@DESKTOP-MGVVROH MINGW64 /d/githubrepositories (main)
$ git commit -m "first"
[main ddf8b91] first
 29 files changed, 2587 insertions(+)
 create mode 100644 Project.md
 create mode 100644 gitbook/fonts/fontawesome/FontAwesome.otf
 create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.eot
 create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.svg
 create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.ttf
 create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.woff
 create mode 100644 gitbook/fonts/fontawesome/fontawesome-webfont.woff2
 create mode 100644 gitbook/gitbook-plugin-back-to-top-button/plugin.css
 create mode 100644 gitbook/gitbook-plugin-back-to-top-button/plugin.js
 create mode 100644 gitbook/gitbook-plugin-fontsettings/fontsettings.js
 create mode 100644 gitbook/gitbook-plugin-fontsettings/website.css
 create mode 100644 gitbook/gitbook-plugin-highlight/ebook.css
 create mode 100644 gitbook/gitbook-plugin-highlight/website.css
 create mode 100644 gitbook/gitbook-plugin-search-pro/jquery.mark.min.js
 create mode 100644 gitbook/gitbook-plugin-search-pro/search.css
 create mode 100644 gitbook/gitbook-plugin-search-pro/search.js
 create mode 100644 gitbook/gitbook-plugin-sharing/buttons.js
 create mode 100644 gitbook/gitbook.js
 create mode 100644 gitbook/images/apple-touch-icon-precomposed-152.png
 create mode 100644 gitbook/images/favicon.ico
 create mode 100644 gitbook/style.css
 create mode 100644 gitbook/theme.js
 create mode 100644 images/a1.jpg
 create mode 100644 images/a2.jpg
 create mode 100644 images/a3.jpg
 create mode 100644 images/a4.jpg
 create mode 100644 images/p1.jpg
 create mode 100644 index.html
 create mode 100644 search_plus_index.json

hu211@DESKTOP-MGVVROH MINGW64 /d/githubrepositories (main)
$ git push -u origin main
fatal: unable to access 'https://github.com/Hu-xiao-max/upalab.git/': OpenSSL SSL_read: Connection was reset, errno 10054

hu211@DESKTOP-MGVVROH MINGW64 /d/githubrepositories (main)
$ git push -u origin main
fatal: unable to access 'https://github.com/Hu-xiao-max/upalab.git/': OpenSSL SSL_read: Connection was reset, errno 10054

hu211@DESKTOP-MGVVROH MINGW64 /d/githubrepositories (main)
$ git push -u origin main
Enumerating objects: 42, done.
Counting objects: 100% (42/42), done.
Delta compression using up to 4 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (41/41), 10.47 MiB | 3.02 MiB/s, done.
Total 41 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/Hu-xiao-max/upalab.git
   c494280..ddf8b91  main -> main
branch 'main' set up to track 'origin/main'.

The reason for this error may be that the proxy is turned on, I turned off the proxy

then try again

 Or not

i turned off vpn

 then you can

Upload is successful at this time

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324330661&siteId=291194637