This is the third day of my participation in Gwen Challenge

Upload the project code to GitHub

Git config --global user.name "xiaoming" / 2. Git config --global user.email "[email protected]" Git init git add command to add your project to your repository. Add all files in this directory to the repository, Git commit -m "first commit" commits the project to the repository (the quotes are the committed logs/this is the description of the added items) Git push -u origin master git push -u origin master git push -u origin master git push -u origin masterCopy the code
Git remote add origin [email protected]/example.git // Push -u origin master // Note: After the change, the origin needs to be specified for the first uploadCopy the code
Git clone [url] git clone [urlCopy the code
Git add * -- git commit -m -- git commit -m -- git commit -m Git pull git push git push back to Github to refresh the pageCopy the code
Git add * -- git commit -m -- git commit -m -- git add * -- git commit -m -- git commit -m Commit simply commits to the cache area git pushCopy the code

Git push code error

Fatal: The current branch master has no upstream branch. To push The current branch and set The remote as upstream

Scene reappearance

Git add. Git commit -m'xxx'
git remote add origin https://[email protected]/xxx.git
git push
Copy the code

“The current branch master has no upstream branch.”

The cause of the problem is that the local branch is not associated with the branch of the remote warehouse, as shown in the figure

Corresponding Chinese meaning:

Fatal: The current score master has no corresponding upstream branch. Git push –set-upstream Origin master git push –set-upstream origin master git push –set-upstream origin master ——> Simply speaking, the local warehouse is not associated with the remote warehouse, corresponding to not up, do not know where to push.

The reason:

By default, git pushes are usually sent to the Master branch of Origin. When there are too many Repositories and branches and no associations, Git gets confused because it can’t determine where you want to push.

Solutions:

Git push –set-upstream origin master git push –set-upstream origin master

Git push -u origin master git push -u origin master git push -u origin master Git remote add origin [email protected]/xxx.git git remote add origin [email protected]/xxx.git

Git alter remote repository address

Situation: When we change our user name on Github, the original warehouse address will become invalid and an error will be reported when we push it. As shown in figure:

Solutions:

Git bash

2. Modify the configuration file

3.1 Git bash Configuration

Git remote -v check the original fetch and push paths

(2) git remote set-url origin github.com/xxx/xxx.git

Git remote - $git remote - $git remote - $git remote

3.2 Modifying the Configuration File

Go to the.git folder, find the config file, open it and change the URL

At the end

Above for use in the process of sorting, also not complete there are a lot of knowledge points did not list, there is a mistake welcome big guy put forward to correct!