Upload local folder to Github

Step 1. Download git

  Download the git client and install it locally.

Step 2. Create a new repository (Repository) in github

insert image description here
insert image description here

Step 3. Set SSH key

  1. C:\Users\用户名\.sshCheck whether the ssh key exists, and check whether the file exists in the local computer path ( ) id_rsa.pub, if it is as follows, go to step 4 directly.
    insert image description here
  2. If id_rsa.pubit does not exist, enter the following command,
ssh-keygen -t rsa -C "email"  # email为你在github上注册的邮箱

Then press Enter, you need to enter two strings to generate the key, remember these strings, you can submit them later, you can also press Enter directly, it is recommended to press Enter directly, and the following figure appears, indicating the key Generated.
insert image description here
3. Open C:\Users\用户名\.ssh), id_rsa.pubthis already exists.

Step 4. Add SSH keys

Add SSH keys in the github setting, and follow the steps in the figure below;
insert image description here

insert image description here
insert image description here
insert image description here

Step 5. Upload local files to github

  1. First create a folder locally, named here test, and put the files to be uploaded testinto the folder.
  2. Right-click testthe folder, open Git Bash Herethe pop-up command window, and enter the following statement to upload.
git init  # 在此文件夹生成一个.git隐藏文件;
git add . # 将文件添加到缓存区( 注意这个".",是有空格的,"."代表这个test这个文件夹
          #下的目录全部都提交,也可以通过git add 文件名 提交指定的文件);
git status # 查看现在的状态,也可以不看,随你啦,可以看到picture文件夹里面的内容都提交上去了;
git config --global user.name "your name"  # "your name" 是github用户名字
git config --global user.email "your email"  # "your name" 是github注册邮箱
git commit -m "这里是注释"  # 提交添加到缓存区的文件
git remote add origin https://xxx@xxx/test.git   
# 添加新的git方式的origin, github上创建好的仓库和本地仓库进行关联
git push origin master  # 把本地库的所有内容推送到远程仓库(github)上,即上传本地文件。

If the image below is displayed, it means the upload is successful (the image comes from reference 1 ).
insert image description here

reference

[1] Upload local files (folders) to GitHub and update warehouse files
[2] Github implements local folder uploads

Guess you like

Origin blog.csdn.net/qq_49323609/article/details/131968488