Getting the Git command to delete the file and upload large files to Github (b)

Since 2013, the author of the code is basically to share CSDN download area, the first set are free, but with the increase in downloads, automatic score increase. In order to better share the revenue code and related tools to catch up with the trend of the times, the authors will follow the code share on Github and CSDN. This article details the basic operation Github web version, by Git commands to delete files and folders and large files uploaded to Github, summed up the experience. Very basic article, we hope to help readers, especially beginners. We also welcome attention to my Github, ha ha ~

Here Insert Picture Description


A Web version .Github new construction

This paper explains the basic usage Github page version using the web version is very easy to manage our resources, "halo" command-line students are familiar with Windows systems and is particularly suitable. The disadvantage is unable to upload large files (25M or more), you can not delete the file and upload speeds worrying, others are good.


Step one: Open Github website and register Home after landing, as shown below.

Here Insert Picture Description


Step Two: Click "Start a project" or the upper right corner "New repository" new construction.

Here Insert Picture Description


The third step: The name and description of the installation work, where the author of "knowledge map real movie column" is set to "Knowledge-Graph-Movie", click on "create repository" to create a warehouse. Note that "initialize this repository with a README" checked, will add a README.md file.

Here Insert Picture Description


Fourth step: After creating as shown in FIG. Important it is to the upper right corner to create a file and upload files two buttons, we then need to use.
https://github.com/eastmountyxz/Knowledge-Graph-Movie

Here Insert Picture Description


The fifth step, create files and folders.
Click on "Create new file" button in the pop-up page, enter the folder name "blog01_spider_kg", then enter "/", then enter the file name "get_details.py". At this time, successfully created the "blog01_spider_kg" folder, and the folder is created in Python files.

Here Insert Picture Description

Then enter the corresponding code, click on the "Commit new file" button to create success.

Here Insert Picture Description

Display content as shown below:

Here Insert Picture Description


The sixth step, to upload files.
When we created the folder, other files can then be uploaded to the Resources folder. Click into "blog01_spider_kg" the folder, press the "Upload files" button.

Here Insert Picture Description

Then select the file and click on "Commit changes" to upload. As the speed problem, if the file is large, with a single file upload.

Here Insert Picture Description

Here Insert Picture Description


A seventh step document, finally displayed as shown in FIG.

Here Insert Picture Description


Notice that there are two problems.

  • When we file upload error, how to delete it?
  • Github Web version only supports file less than 25M, and if more than 25M, and how to solve it?

At the same time remind you that if the larger whole resource, which we want to download a piece of software, then you can click to download, as shown below:

Here Insert Picture Description



II. Delete File

Suppose we want to remove the root directory "blog_03_04_wc_analysis.py" and "blog_03_05_tfidf.py", web version is not directly deleted. We need to install Git tools for command line operation.

Epidemic resources: https://github.com/eastmountyxz/Wuhan-data-analysis

Here Insert Picture Description

The core command:

1) 帮助命令
$ git --help 

2) 设置SSH
ssh-keygen -t rsa -C "[email protected]"
cat ~/.ssh/id_rsa.pub

3) 初始化访问资源
git init
git remote add origin git@github.com:eastmountyxz/Wuhan-data-analysis.git

4) 将远程仓库里面的项目拉下来
git pull origin master

5) 查看有哪些文件夹
dir

6) 删除文件
git rm -r --cached blog03_05_tfidf.py

7) 提交操作
git commit -m 'del file'

8) 更改提交至Github项目中
git push -u origin master

The first step, run Git Bash, as shown in FIG.

Here Insert Picture Description

Here Insert Picture Description


The second step, to see if there .ssh folders and keys. If the file does not exist, you need to re-create, as shown below, create a new ssh keys, or git can not upload files.

cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"

Note: Remember this password, follow-up will be used repeatedly.

Here Insert Picture Description

By "cat ~ / .ssh / id_rsa.pub" command to query SSH Keys, as shown below.

cat ~/.ssh/id_rsa.pub

Here Insert Picture Description

It will be in C: \ Users \ create SSH keys under xiuzhang \ .ssh path, and two files are generated rd_rsa and id_rsa.pub.

Here Insert Picture Description


The third step, SSH Key bindings Github.
In the upper right corner click on Github picture, select "Settings". Enter the Settings page, click on the "SSH and GPG keys", and then click on the "New SSH key" to create a new key, and enter the Title Key, Key Note values idb_rsa.pub can copy the contents of the file.

Here Insert Picture Description

After adding the key password, the password is provided in front of SSH Keys Git password.

Here Insert Picture Description

At this time, the key to create results, as shown in FIG.

Here Insert Picture Description


The fourth step, Git go to a local new folder "Wuhan-data-analysis", the remote pulled down inside the warehouse project.

cd Wuhan-data-analysis
git init
git remote add origin git@github.com:eastmountyxz/Wuhan-data-analysis.git
git pull origin master
dir

Here Insert Picture Description

Downloaded to the local as shown below:

Here Insert Picture Description


The fifth step, the beginning of a delete operation.

  • $ Git rm -r --cached Photo \ albums Delete Photo \ albums folder contents
  • $ Git rm -r --cached blog03_05_tfidf.py delete the contents of the file Python
git rm -r --cached blog03_05_tfidf.py
git rm -r --cached blog03_04_wc_analysis.py
git rm -r --cached blog03-text-mining-lda/blog03_07_hierarchy.py

Here Insert Picture Description


The sixth step, commit the removal, in which "del files" for the corresponding operating instructions.

git commit -m 'del files'

Here Insert Picture Description


The seventh step, this change will be updated up to github project.

git push -u origin master

Here Insert Picture Description

The final display content as shown below, can be seen that three files are deleted successfully, wherein two in the root directory, is located in another folder.

Here Insert Picture Description



III. Upload large files

Then we want to "blog02_seaborn_kg" folder contents uploaded to Github KG directory, if the file is too large and too, using the web version is very troublesome, and the upload speed is worrisome.

Here Insert Picture Description

Here Insert Picture Description

At this point Github display contents as shown below, we want to create "blog02_seaborn_kg" and related content in the root directory.

Here Insert Picture Description


The core command:


The first step, go to the relevant directory.

cd KG
dir
pwd

Here Insert Picture Description


The second step, the command git init will be converted to a local folder can manage Git repository, then by looking at the state of Git warehouse. If there are files in the folder is prompted red, as shown below.

git init
git status
git add .
git status

Here Insert Picture Description


The third step is to create a good Git Github repository and local warehouse associate, then any files remote code library to pull into native code library.

git remote add origin git@github.com:eastmountyxz/Knowledge-Graph-Movie.git
git pull origin master
dir

Here Insert Picture Description

Local folder as shown below, Github successfully synchronized to the local relevant content, then we need to blog02 content upload.

Here Insert Picture Description


The fourth step is to submit the project to the warehouse, create a command is submitted.

git commit -m 'upload'

Here Insert Picture Description


The fifth step, this change will be updated up to github project.

git push -u origin master

Here Insert Picture Description


The final upload page as shown below, you can see "blog02_seaborn_kg" folder and related code.

Here Insert Picture Description

Here Insert Picture Description



IV. Summary

I write to you, this article will describe to complete, consists of three parts:

  • How to use the web version of Github upload and manage resources
  • Git how to use the command line to delete the specified file Github
  • How to use Git commands to upload large files or folders related

In short, we hope this fundamental article helpful to you, the author of a novice in this field, and you want common progress. Recent research has digital signature system security and PE file, really hard, but also slowly forward, refueling ~

(By: Eastmount 2020-03-01 0:00 http://blog.csdn.net/eastmount/ )



Published 440 original articles · won praise 5851 · Views 4.81 million +

Guess you like

Origin blog.csdn.net/Eastmount/article/details/104712191