First, install the GIT client http://code.google.com/p/git-osx-installer/downloads/list?can=3
Second, registered GitHub account https://github.com/–>pricing and signup–>create a free accounts
Third, check SSH create. ssh folder create ssh
1. Check if SSH is present
Mode one: Open terminal input Command CD ~/.SSH
Mode two (shortcut key): Shift + Commond + G then enter ~/.SSH to go
There's going to be 2 files in there.
If it's the previous one, you can back up and then delete the new SSH (because starting from scratch, it's always no harm to do a little bit more)
2. Create the. ssh folder (I deleted the new one here)
Open the terminal to create the. SSH folder (Note: Terminal creation, if not created by the terminal, will be prompted with the system-occupied) command mkdir. SSH
is blank after creation
3. Create an SSH
Open Terminal Input command ssh-keygen-t rsa-c [email protected] ([email protected] is your github registered e-mail) Note: The blue is the return input command, press ENTER and finally get the following to create
Open. SSH folder will appear Id_rsa and id_rsa_pub two files
Then open Id_rsa. Pub file copy inside content (next to use)
Open with one: You can use the editor to open
Open Mode II: Direct terminal command Copy pbcopy < ~/.ssh/id_rsa.pub
Iv. adding SSH to GitHub
Login to GitHub Select Account settings-> SSH and GPG keys
1.
2.
3. Select the new SSH key (title to write, key is the contents of the previous step id_rsa.pub file)
4. After the addition, open the terminal test is not connected to the SSH-T [email protected]
It is also possible to find that the key is grey without the connection.
Enter after the terminal Input command, will prompt some in and out of the green section, and then appear the yellow ToolTip indicates the link was successful.
On the go back to GitHub refresh look down • It turns green.
So far our pre-work has been completed. When I first started, I walked a lot of pits, and I said it later. Go through the whole process first.
Five, upload code
1. Build your own Repository Create a New Repository on GitHub
2.1, generally project name 2, item description 3, public and nonpublic 4. If you don't want others to download it, you can choose
When you are finished creating the following
3. Open the terminal upload code (switch to the project directory you want to upload) Red section all the way down if the green last green section indicates the upload was successful.
Back to GitHub, here's the screen.
Explain the command entered:
touch README.md //新建一个记录提交操作的文档git init //初始化本地仓库add README.md //添加add //加入所有项目git status //检查状态 如果都是绿的 证明成功"first commit"add origin [email protected]:youname/Test.git //连接远程仓库并建了一个名叫:origin的别名git push -u origin master //将本地仓库的东西提交到地址是origin的地址,master分支下
PS: I have a problem here, I opened the project I just uploaded I wrote the code is missing. I've been doing this for a long time.
My side of the solution is: Open the terminal under the submission
$ git add .$ git commit -m “update”$ git push
But the blog wrote here, I want to find the problem, the brain is not enough to make, my first time only submitted the Readme.md file did not submit other files. Last git Add. To submit it all. haha · OK Solution
Here a project is uploaded to GitHub, in order to check whether the upload success can be downloaded to see if it is written by themselves.
FAQ
1)
If you enter$ Git remote add origin git@github.com:Djqiang (GitHub account name)/gitdemo (project name). Git prompt error message:Fatal:Remote origin already exists.1, first enter$ Git remote RM origin2, re-enter$ Git remote add origin git@github.com:Djqiang/gitdemo.git will not be an error!3, if you enter$ Git remote RM origin or an error,Error: Could notRemove config section' Remote.origin '. We need to modify the contents of the Gitconfig file4and find the installation path of your GitHub, mine isC:\Users\ASUS\AppData\Local\GitHub\Portablegit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\etc5, find a file named Gitconfig, open it and put the [remote"origin"The line is erased!
2)
如果输入$ ssh -T [email protected]出现错误提示:Permission denied (publickey).因为新生成的key不能加入ssh就会导致连接不上github。解决办法如下:1、先输入$ ssh-agent,再输入$ ssh-add ~/.ssh/id_key,这样就可以了。2、如果还是不行的话,输入ssh-addnotopenato your authentication agent.解决方法是key用Git Gui的ssh工具生成,这样生成的时候key就直接保存在ssh中了,不需要再ssh-add命令加入了,其它的user,token等配置都用命令行来做。3、最好检查一下在你复制id_rsa.pub文件的内容时有没有产生多余的空格或空行,有些编辑器会帮你添加这些的。
3)
toto .......解决办法如下:1、先输入$ git pull origin master //先把远程服务器github上面的文件拉下来2、再输入$ git push origin master3、如果出现报错 fatal: Couldn‘t‘originnottonot read from remote repository.4、则需要重新输入$ git remote add [email protected]:djqiang/gitdemo.git
My github Address: https://github.com/yj229201093
This process I took a long time, at first, the lack of experience, English is not good is a pit. If there is bad also hope pointed out, suitable for new people to view!
Experience: Sometimes a lot of seemingly simple, on-line search is also a lot, but it is not as good as their own hands-on to do it again. Do it yourself again, understand deeper, know more.
Reference Link: http://www.jianshu.com/p/e7501b968256
http://blog.csdn.net/sinat_28585351/article/details/51452299
Mac system uploads projects using GitHub