I first created the local repository git_tutorial
Then refer to the official git tutorial to use git remote add origin
to add a remote warehouse
Then use git remote
to view the origin warehouse
As a result, the following error was encountered when using git push origin master
:
It shows that the warehouse is not found.
Want to ask what the problem is? How to solve it?
I checked stackoverflow and someone said git remote add
This method is equivalent to creating a new repository on github:
I think this statement is correct. But many people told me that I must first create a warehouse on github before I can use steps 3 and 4. Which statement is correct? If it's the latter, then it feels like using git bash is useless...
Later I built a warehouse on GitHub, and then I did the git remote
and git push origin master
operations, and there was an error:
Following Liao Xuefeng’s tutorial and YueLinHo’s answer on GitHub, the push was successful:
Thank you for answering your questions.
淡淡烟草味2017-05-02 09:51:09
Git remote add method is equivalent to new repository on github
git remote add
It just adds a reference locally and is not responsible for creating a new repo
Your current problem is that these errors are reported because UserName and Email are not configured. Here’s a reminder for you:
Solution: git config --global user.name "xxx"
git config --global user.name "xxx"
git config --global user.email "xxx@xxx.xxx"
git config --global user.email "xxx@xxx.xxx"
where xxx are both Replace it with your own.
Also you said, "If it's the latter, then gitbash is useless". . Why? (If what you submit is all markdown and no other code, then just pretend I didn’t ask)
I only give you a github web page, how do you submit your own commit?
我想大声告诉你2017-05-02 09:51:09
It is true that your remote warehouse must be available in advance. The whole process is to create a link between your remote warehouse and the local warehouse. Then you can submit it directly to the remote warehouse....
曾经蜡笔没有小新2017-05-02 09:51:09
The prerequisite for remote submission is that you must first have a remote library, but this remote library does not necessarily have to be from github. Gitlab and coding can also be used. In addition, bash is not required. I have installed git now. Setting the user name, password and remote address of the library is done with TortoiseGit, and then submission, branching (opening and cutting branches) and push/pull are all done directly with the editor (using vscode, I directly use bash It is hooked into the editor. When you occasionally need to use commands, such as git fetch -p
it is more convenient to use bash for such operations), you can do common operations without bash.
巴扎黑2017-05-02 09:51:09
You must first create a warehouse on github.
Why?
Think about it, you are not asked to enter your username and password when you git remote add, but you are required for git push.
If this will create a warehouse without a password, then I can create other people's warehouses at will.