Click Start a Project New
The following section transmits http://blog.csdn.net/s740556472/article/details/55000019
Here we have a step to do:
输入git config --global user.name "unlimitbladeworks",这里的unlimitbladeworks是注册的用户名,你得改成你自己的
输入git config --global user.email "[email protected]",这里的邮箱也是用户注册的邮箱,你得改成你自己的
Because I was logged in before, here do not do a demonstration of the illustration, we follow their own user name and mailbox can be.
We can use the following commands to create an empty test folder, where the name of the folder you created is identical to the name of your remote repository , that is, the repository name on GitHub Web page is called test, so we also create a test folder here. The command is as follows:
//进入d盘cd d://在d盘下创建一个test文件夹mkdir test//进入到test文件夹下cd test
Let's get down to the chase!
1.the first ..... (The directory we are working on is now operating under the folder named Test.)
First, let's start by initializing the local repository, with the following command:
git init (初始化文件为git可以操作的文件)
The point here is that when the above command is completed, it is equivalent to creating a hidden one under your test folder. git files
2.the second .....
The second step, the local create a Readme file, right-click Notepad Open, which wrote about the changes in this commit, and I am here as a test, so it was written inside this is a test! ..... The command is as follows:
touch README(创建一个README文件)git add README(添加README) commit -m ‘test commit(这里是写你本次提交的描述,这里一定要写不能空着)‘(将添加的README文件做提交)
Changes under the local file directory such as:
3.the next .......
The third step is to submit the local repository via our remote address.
Click Clone or download: The URL that appears is the remote warehouse address we need to use
The Submit command is as follows:
add origin https://github.com/unlimitbladeworks/test.git
//执行push分支git push origin master
Remember that I opened a question to dig a hole for myself ... It is here, submitted to the remote warehouse when the error occurred, why this mistake? It is because my remote repository files and local files are inconsistent, there is a file called Readme in my remote repository, and in my local repository I have a new readme, but there is no original remote repository of the Readme file, which caused the version conflict, then how to solve it?
Solution:
It's really simple, just pull the code from the remote repository
The command is as follows: ( Note here This command is wrong!!!) )
master(注意这里这个命令是错的!!!)
After this command, the diagram is as follows:
I rub, it's not scientific ... One more mistake .... So I searched the internet--and found out that because they were two different projects to merge two different projects, git needed to add a code ....
The code is as follows:
--allow-unrelated-histories(这里是正确的代码!!!!!!!)
Success!
Finally, don't forget to continue submitting your local repository because the steps above are to merge with the remote repository.
At this end ..... Go back to the GitHub page to refresh and look at the results of the wood has just been done ...
Click to see the specifics:
Summarize:
It's actually a 5-step process:
Enter the directory of your project:
commit -m ‘‘(提交描述)git remote add origin url(你的远程仓库地址)git push origin maseter
But remember that if the push reports the same mistakes as mine, you can use pull to fix them, and push them again.
--allow-unrelated-histories
If it appears
- Warning:lf'll be replaced by CRLF
- Fatal:crlf would is replaced by LF
Just use the command below to
- git config--global Core.autocrlf true #这个是转换, is also the default value
- git config--global CORE.AUTOCRLF input #貌似是上库转换, moving out of code from the library does not convert
- git config--global Core.autocrlf false #这个一般是window上的, do not convert
A prompt error message appears: Fatal:remote origin already exists.
Then use git remote rm Origin
Uploading items to GitHub