Using the github remote warehouse, multiple people can jointly develop the same project

Create a remote warehouse on github

1.登录github,GitHub: Where the world builds software · GitHub

Enter this page

2. Download git

Download address: Git - Downloads

Choose to download according to the computer operating system, choose this for windows system

3. Create a warehouse

Go back to the page after github login and create a warehouse

4. Fill in the warehouse name and click create repository

5. Click create repository, the remote warehouse has been created

6. After installing git,

Find the git installation path, double-click git-bash.exe

Use the git command to fill in the username and email

Steps to add SSH key on github

7. Enter this command on the command line to generate a key

ssh-keygen -t rsa -C "邮箱@  .com"

At this time, two files are generated. Remember that id_rsa is the key. Do not leak the key. id_rsa.pub is the lock. What needs to be uploaded later is the lock, not the key.

8. Come to github, click on your avatar, find Settings - SSH and GPG keys-New SSH key

9. Enter the following command on the command line to view the content in id_rsa.pub and copy the content.

cat ~/.ssh/id_rsa.pub

10. On the ssh keys page on github, paste the content you just copied into the input box below the key

11. Enter the following command in git bash to test whether the ssh key is set successfully

ssh -T [email protected]

This sentence appears Are you sure you want to continue connecting (yes/no/[fingerprint])? Enter yes

Enter passphrase for key '/c/Users/.ssh/id_rsa': Enter the password (the password when setting the key)

After entering the correct password, you will see this sentence

Hi username! You've successfully authenticated, but GitHub does not
provide shell access.

If the user name is correct, it means that the ssh key is successfully set up. If you see "access denied", or it means access is denied, then you need to use https to access instead of SSH.

Note:

  • One computer only needs one SSH key 
  • One SSH key can access all your repositories, even if you have 1,000,000 repositories, no problem
  • If you bought a new computer, regenerate an SSH key on the new computer, and upload this key to GitHub, it can coexist with the previous key on GitHub
  • If you delete the key from the computer, just regenerate a key to replace the previous key

Upload the local warehouse to the remote warehouse

12. Find the local project directory and switch to this directory in git bash

Because the directory in git bash is the user directory, switch directly from the directory under the User username

13.git init initializes the local file to make it a file managed by git

add local file after

git add .

git add . Note that there is a space between add and . Add all files in this folder.

git add file name: add a specified file

Then add the contents of the staging area to the warehouse area

git commit -m "本次提交的说明信息"

Enter the github warehouse, click ssh, and copy the warehouse address

In git bash type

git remote add origin 仓库地址

Submit the local to the remote warehouse, add -u when you push for the first time, and don't add -u afterwards

git push -u origin master

14. Finally, you can see it on github

Finally, put a video link of station B where Xiaobai comprehensively learns github , for reference only.

Guess you like

Origin blog.csdn.net/qq_44985985/article/details/112095475