GitHub is a git-based code hosting platform. Paying users can build private warehouses. Free users can only use public warehouses. For ordinary people, public warehouses are enough and there is not much code to manage. The following describes how to use GitHub for beginners.
1. Create a warehouse
Click the plus sign in the upper right corner and select new repository ,:
Enter the repository name and select initialize this repository with a readme. This means that the readme. md file is automatically generated when the repository is created, and then create repository ,:
Ii. Install the client msysgit
GitHub is a server. If you want to use git on your computer, you still need a git client. Here we use msysgit, which only provides the core features of git and is based on command line. If you want a graphical interface, you only need to install tortoisegit on the basis of msysgit.
After installing msysgit, right-click the folder and select "Git init here. git folder, which indicates that the local git is successfully created. Right-click git bash and enter the GIT command line to clone the newly created repository to the local machine. Of course, we also need to configure the SSH key.
3. Configure git
Create an SSH key locally:
ssh-keygen -t rsa -C "[email protected]"
Change [email protected] To your mailbox. Then, confirm the path and enter the password. Here, use the default one-way carriage return. If it succeeds ~ /, Generate the. Ssh folder, open id_rsa.pub, copy the key in it, go back to GitHub, go to settings, select SSH keys on the left, add SSH key, enter the title, and paste the key. In git bash, enter:
ssh -T [email protected]
If this is the first time, you will be prompted whether to continue. If you enter yes, you will see: You 've successfully authenticated, but GitHub does not provide shell access, which means that GitHub has been successfully connected.
Next, we need to clone the repository created on GitHub to the local machine. Before that, we need to set username and email, because every time GitHub commit records them.
git config --global user.name "your name"git config --global user.email "[email protected]"
Clone to a local device (for example, clone a CSS project ):
git clone [email protected]:zhuyujia/css.git
Note: GitHub provides three URL paths (https, ssh, and subversion). Generally, if the account is logged on, we can use SSH, just like the above Code, if you have not logged on, you can only use the https url ,:
The clone is successful, as shown below:
4. Modify, submit, and upload
We can modify and clone the local project. After the modification is complete, add the modified file (. indicates all), enter commit, and then push it to GitHub.
git add .git commit -m ‘update‘git push
References:
1. GitHub simple tutorial
2. How to upload files to GitHub for beginners