GitHub is a good tool for managing code that needs to be configured on Ubuntu now, with three sections in the first section on how to configure GitHub on a PC that has never previously been provisioned on GitHub. The second section describes how to create a new repository remotely and upload the code locally, and the third section describes how to clone the code remotely and modify the upload
1. Configuring the GitHub Environment
As shown, enter the above instruction in the terminal, the contents of the single quotation mark is your GitHub account, and then all the way to enter, This time will be in the home directory under the. SSH folder to generate a suffix named. pub file, edit this file, such as the second of the command, and then copy the file contents, add the key in the remote own GitHub, add the way to click on your avatar and click setting, there is an SSH on the left and GPG keys, then click New Keys, then a name, fill in key. Let's talk about what this is done, and actually this step is to get your local host connected to your GitHub account remotely, which means that your local git command is all about your account, so the problem is, like in a specific folder, I want to upload the contents of the folder to GitHub's specific warehouse, how to do it? This is what our next SectionTo tells us.
2. Create a new warehouse on GitHub and push code
After the remote new warehouse, in fact, the remote has told you how to push, we still demonstrate, step four is to configure your user name and your user password, step 5 is the core step, after the new million file, for example, here my new file is test_ma.py, then git init, Initialize git, then git Add. Add all the changes now in the local cache, then give those changes a name, then git remote add origin ... Add the name of the remote repository, that is, after the new warehouse will be a link to the SSH, copy, why is origin, this involves branching problem, but generally this is possible, and then Git push-u Origin master, this is only the first time this operation, For the second or later operation, GIT init is not used, and git remote add is not necessary. And without Git push-u Origin master, direct git push can
3 from remote clone code
First put someone else's code into their own code, direct git clone, if the speed is slow, direct proxychains, will be accelerated, such as above you create a new file, called test_mamama.py, and then git Add. Commit and git push, note that there is no git init here because the. git files are automatically preserved at Gitclone and do not have remote add Because there is a record in the. git file that is downloaded from the repository, and the remote is refreshed, you will find that there is a test_mamama.py
Ubuntu configures GitHub and creates a new warehouse push code, from the existing warehouse clone code, and push