banner
xingli

xingli

猫娘爱好者

Basic Tutorial on Using Git

Upload Files#

  1. Confirm Connection
git remote -v
  1. Pull the content from a remote branch to the local repository;
# `main` is the name of the remote branch, it can be any existing branch
git pull origin main
  1. Add all files of the project to the repository: git add .

  2. Commit the added files to the repository

git commit -m "Commit message"
git push -u origin main  #*//main is the branch you want to upload to*

To correct the latest commit message of Git, you can use the following command:

git commit --amend -m "New commit message"

Replace "New commit message" with the new message you want to use. This will

Force push to the remote repository and overwrite the remote codebase#

git push -f --set-upstream origin main:main

Switch Branch#

git branch -M main

Github Official#

Quick Installation - If you've done this before#

Start by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

...or create a new repository on the command line#

echo "# vue3Template" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:YlyAyzbl/vue3Template.git
git push -u origin main

...or push an existing repository from the command line#

git remote add origin [email protected]:YlyAyzbl/vue3Template.git
git branch -M main
git push -u origin main

...or import code from another repository#

You can initialize this repository from a Subversion, Mercurial, or TFS project.

Clone GitHub Repository#

import requests
import os

# URL of the GitHub Release page
url = "https://api.github.com/repos/apernet/hysteria/releases/tags/app%2fv2.2.0"

# Replace with your GitHub username and personal access token here
github_username = "<YOUR_GITHUB_USERNAME>"
github_token = "<YOUR_GITHUB_TOKEN>"

# Create a directory to save the downloaded files
os.makedirs('downloads', exist_ok=True)

# Send a GET request and retrieve the release information
response = requests.get(url, auth=(github_username, github_token))

if response.status_code == 200:
    release_info = response.json()
    assets = release_info['assets']

    for asset in assets:
        download_url = asset['browser_download_url']
        file_name = asset['name']
        download_path = os.path.join('downloads', file_name)

        # Download the file
        download_response = requests.get(
            download_url, auth=(github_username, github_token))
        if download_response.status_code == 200:
            with open(download_path, 'wb') as file:
                file.write(download_response.content)
            print(f"File downloaded: {file_name}")
        else:
            print(f"Unable to download file: {file_name}")
else:
    print("Unable to retrieve release information")

print("All files downloaded!")

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.