Problems that may occur after downloading the compressed package on GitHub

I have learned GitHub by myself before, but I am not very good at learning and it has been useless for a long time. As a result, I helped my classmates to download the code from the website warehouse to the local site today and made many mistakes. Looking back at the notes I made before, it was useless, so I will pick it up again today. Knowledge points, summarize the errors and solutions that occurred this time, so that you can review them later.

1. "Git is not an internal or external command, nor a runnable program or batch file" appears when git checkout is checked out in cmd.

  1. Find the bin location in the git installation path, such as: D:\CommonApps\GitHib\Git\App\Git\bin (D:\CommonApps\GitHib\Git\App is my own path, the same translation below)

  2. Find the location of git-core in the git installation path, such as: D:\CommonApps\GitHib\Git\App\Git\mingw64\libexec\git-core

  3. Right-click "Computer" -> "Properties" -> "Advanced System Settings" -> "Environment Variables" -> find "path" in the "System Variables" below -> select "path" and select "New" -> add The bin and git-core paths found in the above two paths are copied into them respectively -> save and exit

Two, the prompt error is not a git repository (or any parent directory): "fatal: not a git repository (or any of the parent directories): .git"

  1. Enter "git init" (initialize the local) on the command line and press Enter
    insert image description here

3. Git switch branch error: error: pathspec 'XXX' did not match any file(s) known to git

Note: switch branches: there are other branches in the project, and the dist file of the project needs to be deployed to other branches. When I went online,
because there is no XXX file in my master main branch, there are many solutions on the Internet, but I have tried it. It didn't work. I tried many times and finally retried the method of git clone operation, and gave up the method of downloading the compressed package. Here I will summarize and write.

Public tutorial operation:

  1. git checkout develop
  2. git fetch (execute git branch -a to see that XXX has updated branch information)
  3. git checkout XXX

Re-git clone operation:
clone: ​​copy the remote warehouse (the project corresponding to GitHub) to the local

  1. git clone warehouse address (there is a clone download URL in the GitHub page, just copy it)
  2. git config --list (see all content)
  3. clear (clear command)
  4. Execute the corresponding steps like

4. Unable to synchronize or have no permission: The request URL returned error: 403 Forbidden while accessing

Reason: The general reason is private project, no permission, input username and password, or the remote address adopts this type.
Solution:

  1. Modify in the config configuration file in the .git folder:
[remote"origin"]
	url = https://github.com/用户名/仓库名.git

change into:

[remote"origin"]
	url = https://用户名:密码@github.com/用户名/仓库名.git

If there are deficiencies, please give me more advice.

Guess you like

Origin blog.csdn.net/weixin_42676530/article/details/107555102