github
github
Github 本地上更新库
|
Avoid password everytime
when uploading file is to big
|
ignore files
Cite: Git-scm
the name of the file: .gitignore
should keep in the home directory rather than the .git
directory
|
- An optional prefix “!” which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded.
- An asterisk “*” matches anything except a slash.
- A trailing “/" matches everything inside. For example, "abc/” matches all files inside directory “abc”, relative to the location of the .gitignore file, with infinite depth.
- A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, “a/**/b” matches “a/b”, “a/x/b”, “a/x/y/b” and so on.
Delete large files
|
Another way to solve the same problem
|
Git push with ssh
Documentation: Github
Follow the instructions from Github to generate a ssh public key first.
Be sure about add the email for config the user
Exp:
|
After that, copy the key into github.
You may still find that Username is needed for push.
According 2240, we need to change the type or remote link.
Test Your Connection
Once you down, you could test the ssh connections with ssh -T git@github.com
. If it works fine, you’ll get the greating form GitHub:
Hi Karobben! You've successfully authenticated, but GitHub does not provide shell access.
If you are running on another environment, you’ll get a warning. But it would be fine, just input yes
would solve all problems.
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '140.82.114.3' Offending key for IP in /home/ken/.ssh/known_hosts:9 Matching host key in /home/ken/.ssh/known_hosts:69 Are you sure you want to continue connecting (yes/no)?
Ready Your Local Repository
Enter your github repository page and select the ssh link to configure the local repository as follow and the problem shell be solved.
|
Re-base the Local by Deleting all Local Change
|
Reference: Cameron McKenzie
- The git stash command, which saves uncommitted changes and reset your workspace.
- The git reset command, which only touches tracked files.
- The git clean command, that deletes every untracked file.
Errors
fatal: in unpopulated submodule ‘.deploy_git’
fatal: in unpopulated submodule '.deploy_git' FATAL { err: { Error: Spawn failed at ChildProcess.task.on.code (/mnt/8A26661926660713/Github/Notes_BK/node_modules/hexo-util/lib/spawn.js:51:21) at ChildProcess.emit (events.js:198:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) code: 128 } } 'Something\'s wrong. Maybe you can find the solution here: %s' '\u001b[4mhttps://hexo.io/docs/troubleshooting.html\u001b[24m'
According to ChatGPT (this is a super genius! I can’t find this result anywhere!) The error message you provided is related to Hexo, a static site generator. It seems that there was an issue with a submodule named ‘.deploy_git’ in the Git repository you were working with.
This error occurs when there’s a problem with the Git submodule in your Hexo project, and it’s not able to be cloned. To resolve this issue, try the following steps:
|
These steps should resolve the issue with the Git submodule and allow you to continue using Hexo to generate your static site. If the issue persists, you may need to refer to the Hexo troubleshooting guide (https://hexo.io/docs/troubleshooting.html) for further assistance.
Submodule
In github, you could add entire another repository here with submodule:
|
How to remove the submodule?
To remove a submodule from a Git repository, you’ll need to follow a series of steps to cleanly remove all traces of the submodule from your repository. Here’s how to do it:
1. Deinitialize the Submodule
First, you need to deinitialize the submodule to remove its configuration. Run the following command:
|
Replace path/to/submodule
with the actual path to the submodule.
2. Remove the Submodule from the .gitmodules
File
The .gitmodules
file in the root of your repository contains the configuration for all submodules. You need to remove the corresponding entry of the submodule you want to delete.
Open the .gitmodules
file in a text editor and remove the section corresponding to the submodule. It will look something like this:
|
Save and close the file after removing the relevant section.
3. Remove the Submodule Directory from the Working Tree
After removing the entry from .gitmodules
, you can remove the submodule directory from your working tree:
|
4. Remove the Submodule from the Git Index
Finally, you need to remove the submodule from the Git index (staging area). Run the following command:
|
This command will remove the submodule from your repository’s index, which means it will be removed in the next commit.
5. Commit the Changes
Now that you’ve removed the submodule, commit the changes:
|
6. Remove the Submodule Directory from the Git Directory
As an optional cleanup step, you can remove the submodule’s entry in the .git/config
file and the submodule directory inside the .git
folder. The commands below accomplish this:
|
This sequence of commands will completely remove the submodule from your repository. If you push these changes to a remote repository, the submodule will also be removed from there.
Branches
- Delete branch:
git push origin --delete <remote-branch-name>