Gitpod cannot push to Github’s solution
Gitpod introduction
Gitpod is an online IDE editor that allows you to quickly set up a programming environment without having to build your own. Gitpod can directly import the project on Github and start editing.
Github’s interface, extension and usage are the same as VSCode, which is a blessing for VSCode users.
official website: Gitpod
The solution
Tag Archives: Go
Git uploads local IntelliJ idea project to GitHub
Install git client under Window.
two Configure Git/ GitHub in Intellij idea
Open Preference– Version Control.
Drop down and select Github, fill in Host, Login, and Password, and Test was successful.
Select Git and specify the Git path. Test to see if the function is working.
3. Project local Git commit
1. Create a local warehouse
2. Commit code to Git
Right-click on the SRC or code file, and Git — Add — Commit
Four. Project remote submission
1. Set up a warehouse on Github
2. Configure the remote warehouse locally
CD local warehouse directory
Git RemoteAdd Origin the address of your project
git push-u origin master
There’s going to be a problem here.
The reason is that when we created the warehouse on Github, we checked the default READme.md, which caused a mismatch between local and remote warehousing.
Solutions:
The Git pull origin master
And then git push-u Origin master
3. Push/Pull in IDEA
Right-click on the SRC or code file, Git — Repository — Push/Pull
[git] report error and solve cannot open.git/fetch_ HEAD: Permission denied
Wechat: fangkangfk
Find the file by find/-name FETCH_HEAD
Then give. Git owner, Chow-r git:git. Git changed to Git
error: cannot open .git/FETCH_ Head: permission denied resolved
error: cannot open .git/FETCH_HEAD: Permission denied
The reason:
The current logged in user does not have permission to modify the directory.
Solutions:
Modify the current directory permissions
1. Whoami view the current logged in user
xxx$ whoami
Assume the above query login account as: Zhangsan
2. PWD view current directory
xxx:$ pwd
Suppose the query result of the above directory is: /Users/work
3. Modify permissions for Sudo Chown
xxx$ sudo chown -R zhangsan:admin /Users/work
Sudo Chow-r Current user: Admin Current directory
Pull is not possible because you have unmerged files
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use ‘git add/rm < file> ‘
as appropriate to mark resolution, or use ‘git commit -a’.
Reasons:
In the process of [Git pull], if there are conflicting files, all other files except the conflicting files are saved as antinuclear zone files.
Local push and merge form references such as merge-head and pushhead.
– HEAD represents a local reference formed after a recent successful push;
The -merge-head represents the reference formed after a successful pull.
Solutions:
You can MERGE-HEAD or HEAD to achieve the effect of type and SVN Revet.
1. Open Git console:
Right click on the project –& GT; 【Open in Terminal】 –& GT; Use the Git command console.
2. Input: Git reset –hard FETCH_HEAD
– To reset conflicting local files, not only to merge-head or HEAD, but also -hard;
– No later hard, no local workspace will be flushed. It just overwhelms the stage.
3. Input: Git pull
Resubmission will succeed.
For more highlights, please follow my “toutiao” : Java cloud notes
, anytime, anywhere, to give you the latest, most convenient handheld cloud services
Golong based tool for automatically generating the corresponding struct file according to XML file
XmlLoader. Go and xmlNodeStructCreator. Go are the following two files.
XmlLoader. Go parses the XML into a chained structured data. XmlNodeStructCreator. Go recursively extracts node information from the chained structured data and generates the corresponding structure file of the XML.
This is rough, especially the naming of field in the structure, which is directly named after the node. Interested friends can change it by themselves.
In addition, the Repository contains two other widgets that you may be interested in viewing.
Tool source code
You have not concluded your merge (MERGE_HEAD exists)
Problems with Using SourceTree Merge branches:
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
Then click Termianl on SourceTree and an error occurs:
The error may be caused by code that you pulled down before not merging automatically.
There are two solutions:
1. Keep your local changes
git merge --abort
git reset --merge
Be sure to commit the local merge after merging
Then get the online warehouse
git pull
2. Down the code version, discard local modifications
This is not recommended, but if you have small local changes, or if you have a backup copy of your own, you can overwrite it locally directly with the latest version on your line
git fetch --all
git reset --hard origin/master
git fetch
Of course, the dumbest option is to clone a piece of code and discard the working directory, which is clumsy but equally effective.
Wrong installation of registry to registry
Today, when I was installing Git’s latest version, which is currently 2.5.0, the last step of the installation produced an error as shown in the figure below:
interface on the error message when you can easily see that is written to the registry has been refused to visit, I was thinking whether the registry permissions is not enough, with the right to administrator rights to install again, installed in the end, and the error, and the Internet, may be the version is too new, and not a lot of online solutions, find the solution with administrator rights to install, can I have confirmed that this is not enough. It also says that ignoring the error can be used, but since it is an error, it must be fixed.
After consideration, since you do not have the right to write to the registry, simply enter the corresponding registry, change the registry permissions, the location of the registry is the registry location in the error message above, enter, right click and select modify permissions:
Then, reinstall, and the error is perfectly resolved.
Go start error: Panic: runtime error: invalid memory address or nil pointer reference
For more details, see blog post:
a pit about Golang variable scope
fix:
remove the colon from DB, err := gorm.open:
the original understanding was that golang would define the new variable err, DB was the global variable originally defined. But the reality is that for a variable defined with :=, if the new variable DB is not in scope with the same name as the defined variable (in this case, the global variable DB), then Golang defines the new variable DB to cover up the global variable DB, which is the real cause of the problem.
Git error prompt: fatal: not a git repository (or any of the parent directories):. Git
Solution: Execute the following command line before doing anything: Git init
Then execute Git Status to check the status information, good, problem solved.
How to cancel the commit, how to cancel the commit after git commit, and how to change the submitted content
How does Git cancel commit, how do You cancel the commit after Git commit, and how do you change the commit content
When you’re using Git, you might accidentally click commit, so how do you plug in the commit?
1. You can first check the historical commit record with Git Reflog
Soft, soft
The local code does not change, except that git transitions revert to the pre-COMMIT state
Do not delete the workspace change code, undo commit, and do not undo Git Add.
git reset --soft HEAD~1
Represents the last commit to be revoked, and 1 can be replaced with an earlier number
Hard to cancel
The native code will change directly to the specified commit version. Use with caution
Delete the workspace change code, undo commit, undo Git Add.
Note that after this operation, the last COMMIT state is restored.
git reset --hard HEAD~1
If the message content is just COMMIT, the error is filled in
The input
git commit --amend
Enter ViM mode and make changes to Message
There’s another one, mixed
git reset --mixed HEAD~1
Do not delete the workspace change code, undo commit, and undo git Add. Operation
is the default parameter,git reset –mixed HEAD~1 and git reset HEAD~1 have the same effect.
Error: pathspec ‘origin / xxx’ did not match any file (s) known to GIT
There is a test branch on the project. You can’t see the remote branch by using Git Branch-A. You can directly use the command Git Checkout Test to report the error as follows:
error: pathspec 'origin/test' did not match any file(s) known to git.
Solution:
1. Execute git fetch to fetch updates of all branches
2. You can see the Test branch when executing Git Branch-A (the branch information has been updated).
3. Switch git Checkout Test