Table of contents
Create a remote repository alias
Push the local branch to the remote repository
Clone the remote library to the local (non-project leader)
Collaboration within the team:
Pull the remote library to the local library (project leader)
GitHub Actions
GitHub is a hosting platform for open source and private software projects. Because it only supports Git as the only repository format for hosting, it is named GitHub. GitHub is the world's largest gay dating site, a paradise for tech nerds, and a gateway to a new world.
Create a remote repository
Register and log in to the GitHub website, click the plus sign in the upper right corner to create a remote repository.
Remote warehouse operations
command name | effect |
---|---|
git remote -v | View all current remote address aliases |
git remote add alias remote address | alias |
git push alias branch |
Push the contents of the local branch to the remote repository |
git clone remote address | Clone the contents of the remote repository to the local |
git pull remote library address alias remote branch name | Pull down the latest content of the remote repository for the branch and merge it directly with the current local branch |
Create a remote repository alias
The purpose of creating a warehouse alias is to link the long-linked warehouse with an alias. When pulling and pushing the warehouse link in the future, you can directly use this alias to pull.
git remote -v
git remote add 别名 远程地址
Push the local branch to the remote repository
Because GitHub is a foreign website, the speed of the push depends on your network. If it doesn't work, try it several times.
git push 别名 分支
Clone the remote library to the local (non-project leader)
git clone 远程地址
When we clone the remote library to the local, the following operations will be automatically performed: 1. Pull the code; 2. Initialize the local library; 3. Create an alias. Note: Our clone code does not require a login account.
Collaboration within the team :
When the team members need to modify the project code, they need to clone from the remote library to the local library and then make modifications. After the modification, they must still be submitted to the staging area and the local library.
Next, we need to push our modified code to the remote library, log in to the GitHub associated account, and let the project leader see our modified version.
But before we push, we need the project leader to put our added project management trust zone. Without the permission of the project leader, we cannot push the modified code to the remote library. How to add please see the following operations:
After agreeing, team members can submit the code to the local library, and everyone can see the code submitted by the member.
Collaborate across teams :
Cross-team collaboration is about finding people outside the team to help us modify the code.
If external personnel want to modify the code of this part, they can directly visit the github project link of this part, and then click fork to fork the code into their own project.
Because I only have a GitHub account, it is inconvenient to display the file transfer between the external and the headquarters. In short, after the pull request, the modified content will be automatically compared with the content before the modification. The request is reviewed, and if approved, the externally written code can be merged with the internal code.
SSH password-free login
When using the ssh method, you do not need to verify the user name and password. The ssh key has been configured before, and (if you have not set a password), you can directly push it; when using the http method, you need to verify the user name and password.
The difference between HTTPS and SSH:
HTTPS is conducive to anonymous access, suitable for open source projects, and can be easily cloned and read by others (but no push permission);
SSH is not conducive to anonymous access and is more suitable for internal projects. As long as the SSH public key is configured, clone and push operations can be freely implemented.
Normally, we can't use SSH at the beginning, and a warning pops up for us, requiring us to configure related keys.
Next, configure the keys in SSH:
Right-click Git Bash Here in the current file and execute the following command:
ssh-keygen -t rsa -C 自己GitHub的邮箱地址
Copy the contents of the public key id_rsa.pub to your own GitHub, as follows:
Pull the remote library to the local library (project leader)
git pull 远程库地址别名 远程分支名
Suppose someone modifies the file in the remote library. The modification process is as follows. Our local library needs to pull the remote library code to realize the project modification and update.