Ⅰ. Preparation:
1. Git
View:
First, the command:git --version
// At this time, the version that can be seen in the virtual machine environment git
is:git version 2.41.0
Second, how to install on a virtual machine git
:
A. Command:sudo apt-get install git
B. Then enter the virtual machine password:
// Note:
the command cd ..
is to return to the previous folder (note: there is a space in the middle);
at this time, git
the installation is under the work folder, so work
the files under this folder can be submitted to the code warehouse;
2. Create a folder to be submitted:
First, Linux
create a folder command ( mkdir + '待创建文件夹名称'
):
mkdir frs_web_push
Second, switch to frs_web_push
the directory command:
cd frs_web_push
3. Use compare
the tool to modify the code to be submitted;
Ⅱ. Submission process:
1. Enter git
the command: git status .
(Note: there is a space in the middle)
// Command entered work/frs_web_push/frs
under :
2. Enter git
the command: git add .
(Note: There is a space in the middle;)
3. Enter git
the command: git commit -m"待输入的信息"
(note: there is a space in the middle)
4. You may encounter the problem that user.email
and user.name
are not set (this is used at this time SSH 密匙
):
First, first get email
the value:
A. Enter the command in the virtual machine:cat ~/.ssh/
// At this point you can usually find:id_rsa.pub
B. Enter the command again in the virtual machine:cat ~/.ssh/id_rsa.pub
// At this point, you can get a key and the value of (that is, you can get the value of email
at the end after the command is entered ):email
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC69nohuvDnagn0vbHUATsiXZzQWQK2trAFASYyzcWxFJKCXBBqCvQzsp7+eh+VsIdLqZOf7ENR2Zc4nOaZ3yw1uWa4yv/PcMxOrV/DRE+1NOJxtL0LA5KNwy6QqD5rWhwTQ2nzLtfqU2cbbuqMXRS46Inaq44PMke0CEHXOQgEo95RoeUSZfOygj6Yswaw2ocEnkYme+upUq+B683D4CW+Qy/2XtUUCztuUL/Dc4+hSwfC1QW5L55KMxYZ54P1tqOJ1mavtGH6UojJ9JQ48E1nAiFBRvtznLc4+E5cjxgGN7znFSIrD1jneE2bMRr7fysH36Jg6MrBqem/rDbJ0dgk72pvWGDq+jCKiKQSPZYMz1E4cSlLpE6jT2+h3MxQxZXnmAoG6lxlDLdE907IG0r1cTKYPqiH9DNOVIucGQWm0xA++Oz+9T+5g9X9GPxI6oKUwMPam9hmV+i20i8p69zHxPhNRlNFTHJ7Bs2JvAoG9bEpbud3iGByejQtuey6zSfE0AIq4ZZjE7/Nsqi15DMxp263gqGl/bMf0q2y0aSzCJQfcs3JWUYLl8TZBUaeUVewhbi5XkgFfqw8HaJQIBK3Qy9HNRdwt/eN7NXxEddS100m88PoYHirUvU6sZL4umzMQtP6TFHeBDA7Sx7Xl5FZHf0ufRcAudf+VHXbWGT63w== *******@kemacom.com
Second, set user.email
the command:
// At this point, GitLab
the email uploaded to can be successfully set;
git config --global user.email *******@kemacom.com
Third, set user.name
the command:
// At this point, GitLab
the name uploaded to can be successfully set;
git config --global user.name *******
Fourth, enter the submitted command:
git commit -m"*********"
Fifth, view the command of the git branch:
git branch -a
Sixth, git
the command to push the content to the (new) branch via:
git push origin main:dev-web-*******
// At this point, the code you want to update can be successfully passed to the corresponding code warehouse (ie: successfully submitted to GitLab
);
Seventh, there may be git
wrong commands pushed to the branch:
A、git push origin main
// An error will be reported at this time: it is not allowed to merge on main
the main branch due to the protection of the project branch;
B、git push origin
// An error will be reported at this time: it is not allowed to merge on origin
the main branch due to the protection of the project branch;
C. Reason analysis:
Because main
the and origin
branch need to create a new branch based on this basis to submit the code to be merged;
therefore, when it is necessary to submit, manually create a branch, such as: git push origin main:dev-web-*******
(Note: When git
creating a new branch, it is generally based on a certain branch first ( Such as: origin 或 main
) Create a new branch, and then git
merge it according to the command, but in the virtual machine, you can directly create a new branch based on a certain branch during the submission process)
Eighth, view git
the commands of all branches in:
git branch -r
// At this point, all the branches in the code warehouse can be displayed on the page (at this time, you can find your own newly created branches dev-web-*******
):
Ⅲ. Other useful command lines:
1. The command to return to the previous directory in the virtual machine: cd ..
(Note: there is a space in the middle and a gap with the previous command)
2. View the command of this directory in the virtual machine: ls
(Note: there is a gap with the previous command)
3. View the command of the directory starting with a in the virtual machine: cd a
(Note: there is a space in the middle and there is a gap with the previous command)
Ⅳ. Summary:
First, where there is something wrong or inappropriate, please give me some pointers and exchanges!
Second, if you repost or quote the content of this article, please indicate the address of this blog https://blog.csdn.net/weixin_43405300 . Creation is not easy, but it can be done and cherished!
Third, if you are interested, you can pay more attention to this column (Vue (Vue2+Vue3) interview must-have column): https://blog.csdn.net/weixin_43405300/category_11525646.html?spm=1001.2014.3001.5482