1. Put the code in the code cloud
- Create a new warehouse in Code Cloud. After completion, Code Cloud will have a command tutorial and just click the above.
- Tutorials in Code Cloud
Git 全局设置:
git config --global user.name "ASxx"
git config --global user.email "[email protected]"
创建 git 仓库:
mkdir wap // 项目在本地的路径
cd wap
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://git.oschina.net/name/package.git // 远程仓库地址
git push -u origin master
已有项目:
cd existing_git_repo
git remote add origin https://git.oschina.net/name/package.git
git push -u origin master
Let's talk about the detailed local operation steps:
1. Open your project folder with vs
2. Configure git
Open Git Bash and enter the following command
If you haven’t entered the global configuration, please enter the global configuration first.
Git 全局设置:
git config --global user.name "ASxx"
git config --global user.email "[email protected]"
Then start to do the configuration of submitting the code to the code cloud
cd d:/wamp/www/mall360/wap //首先指定到你的项目目录下
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://git.oschina.net/name/package.git //用你仓库的url
git push -u origin master //提交到你的仓库
Under normal circumstances, after the above command is executed, there will be a hidden .git folder in the local folder, and there should be a README.md file in your warehouse in the cloud.
3. Submit the code to the warehouse in vscode
Go back to VSCode and open the git workspace (that is, the folder where the file -> open project is located directly in VSCode), and you will see all the code displayed here
Click the + sign to submit all files to the temporary storage area.
Then open the menu and select-Commit Staged (Commit Staged)
Then follow the prompt to enter a message in the message box, and then press ctrl + enter to submit
Then push all the temporarily stored code to the cloud
After clicking, it will pop up asking you to enter your account password, just enter the account password of your hosting platform.
If there are no problems, your entire project will be submitted to the cloud.
In VS, you will have to enter the account password every time you update the code, you can configure it to let GIT remember the password account
git config --global credential.helper store //在Git Bash输入这个命令就可以了
4. Synchronization code
Here we talk about the usual modification of the code and then submit it to the cloud for use, and synchronize with the local code and the cloud.
Just open a file and add a comment
You can see that the git icon has a prompt, open the git workspace and you can see the modified file
Then click the + sign on the right to temporarily store him.
Then enter the message in the message box, press ctrl + enter to submit temporary storage
Then click push to submit, and the code will be submitted to the cloud.
You can see it by opening the code cloud. . .
pull use
For example, when you modify the code at home and submit it to the cloud, you only need to open the project with vscode and click pull in the menu to synchronize it.
5. Clone your project to local
I want to modify the code when I get home, but the computer has no files, what should I do? Look down
First, your computer still has vscode and GIT, and then use git to execute the above global configuration again, as follows
git config --global user.name "ASxx"
git config --global user.email "[email protected]"
git config --global credential.helper store
#然后打开Git Bash输入以下命令
cd d:/test //指定存放的目录
git clone https://git.oschina.net/name/test.git //你的仓库地址
The download is successful, and then you can use vscode to open the project and modify it. After the modification, the submission steps are still the same as above: temporary storage-submit temporary storage-push and submit to the cloud is ok.