[Software testing] Git details - get the Git warehouse, the most complete article on the whole network to get through...


foreword

The official provides two methods to obtain the Git repository.
The first is to import all files into Git in the local existing project directory;
the second is to clone the project from the Git warehouse to the local;

Initialize the repository in an existing directory

If it is a window, after entering the local project directory, right click to see git-bash, open the git operation interface, and enter the command

git init

Then you will see that there is an additional .git folder in the directory

B1

If you don't see it, you need to check the hidden items as follows:

B2

At this point, the project initialization has been completed; but the initialization alone is still not enough, and the following commands need to be executed again

git add .
git commit -m "init project"

git add .: is to add all the files in the current directory to the temporary storage area
git commit: submit the files in the temporary storage area to the local warehouse

B3

B4

If you want to push the local warehouse to the remote warehouse, you must first add the local warehouse to the remote warehouse, execute the following command

git remote add origin [url]

origin : It can be understood as a warehouse alias, you can take Github, Gitee, as you like; but origin is the default remote version library name

url: Fill in your remote warehouse address, such as [email protected]:zTree/zTree.git, https://gitee.com/zTree/zTree.git

Finally, push the local file

git push

Abnormal situation 1

B5

Reason: The current branch is not associated with the remote branch, which leads to the failure to submit the code

Solution:
Execute git push origin master directly, and directly push to the specified master branch.
As mentioned above, execute git push --set-upstream origin master
and directly execute git push -u origin master, which is simple and rude!

If you don’t use methods 2 and 3, you need to use the command of method 1 to push every time you push in the future;
if you use methods 2 and 3, you only need to git push in the future

Abnormal situation 2
: If the prompt after push: Permission denied (publickey, it means that your local public key has not been added to the remote warehouse

Abnormal situation 3
If the prompt fails, you can consider forcing the push

git push -f

crash method

For those who are too lazy to look at so many pictures when initializing the warehouse in the local project mentioned above, you can directly read the following commands, just type line by line, and scroll up if you encounter problems

git init
touch README.md
git add README.md          # 可以git add . 提交所有文件
git commit -m "first commit"
git remote add origin [email protected]:用户名/仓库名.git
git push -u origin master

Clone the existing warehouse
git clone will pull every version of every file in the Git warehouse.

The command format is:

git clone [url] 
# url为https格式
git clone https://gitee.com/zTree/zTree_v3.git

#url为ssh格式
git clone [email protected]:zTree/zTree_v3.git

This will create a folder named zTree_v3 in the directory where you execute the command. If you want to customize the name of the local warehouse, you can use the following command

git clone [email protected]:zTree/zTree_v3.git myTree

In this case, the name of the warehouse created locally becomes myTree

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

Only persistent efforts can make our dreams come true; only the courage to struggle can make life full of infinite possibilities. Believe in yourself, follow your passion, and you will become an unstoppable force!

Only with a dream in mind can you soar in the blue sky of life; only by persisting in struggle can you bloom infinite possibilities; only by working hard can you write your own glorious chapter. Believe in yourself, go forward bravely, embrace the future, and chase your dreams! You can definitely do it!

Only by constantly moving forward can we surpass ourselves in the past, pursue our inner dreams, make every day a proof of struggle, let hard work become the foundation of life, and finally reap our own glory and success!

Guess you like

Origin blog.csdn.net/m0_70102063/article/details/131598482