CentOS 7 installation using Github

All operations are performed under root privileges, and non-root users may need elevated privileges.

  1.   First install git
    •   yum install git
  2.   Generate ssh key:
    •   ssh-keygen -t rsa -C "[email protected]", then press Enter all the way to use the default settings.
  3.   View the contents of the ssh public key file
    •   By default, all contents of the file are copied to /root/.ssh/id_rsa.ssh
    •   在github上 -- Personal settings -- SSH and GPG keys -- New SSH key
      •   Title is the name/mark of this key
      •   Paste all the contents of the public key file into the Key
  4.   Test whether the ssh key is successful
    •   ssh -T [email protected], if it prompts You've successfully authenticated, but GitHub does not provide shell access, it means success.
  5.   configure git
    •   git config --global user.email "mail [email protected]"
    •   git config --global user.name "github-name"
  6. upload code
    •   Create a new repository on github like: myproject.
    •   Initialize the environment: cd to the project directory, git init
    •   Add all files in: git add .
    •   Commit: git commit -m "comment"
    •   remote: git remote origin Repository URL: git remote origin https://github.com//github-name/myproject.git
    •   push:                                                      git push -u origin master

update code

Step 1: To view the current git repository status, you can use git status

git status

Step 2: Update all

git add *

Step 3: Then enter git commit -m "update description"

git commit -m "更新说明"

Step 4: First git pull, pull the latest code of the current branch

git pull

Step 5: Push to the remote master branch

git push origin master

Not surprisingly, opening GitHub has been synchronized

download code

github download code is roughly divided into three cases

The downloaded code does not need to include git management nor .git files

At this time, click download directly on github to download. At this time, the downloaded code does not contain git management nor .git files.

The downloaded code should include git management but not configure ssh

If you need git management but do not have ssh permission, you can use git clone repo_url to download the code repo_url is the url of the https card header. At this time, the downloaded code does not have the permission to push. If you need to submit modifications through pull request.

The downloaded code should contain ssh for git management configuration

If you need git management and have ssh permissions, you can use git clone [email protected]:xxx/xxx.git to download the code, so that the downloaded code has push permissions.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325722035&siteId=291194637