Skip to main content

How to add your Source Code to GitHub



Quick setup — if you’ve done this kind of thing before

Get started by creating a new file or uploading an existing file. We recommend every repository include a READMELICENSE, and .gitignore.

…or create a new repository on the command line

echo "# bms" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/xxxxxxxxx/bms.git
git push -u origin main

…or push an existing repository from the command line

git remote add origin https://github.com/xxxxxxxxxx/bms.git
git branch -M main
git push -u origin main

--------------------------------------------------------------------------------------------------------

Proper steps to add existing code to GitHub

The proper way to push a new project into an existing GitHub repository follows these steps:

  1. Create a GitHub repository for the existing project.
  2. Copy the GitHub URL for the new repo to the clipboard.
  3. Perform a git init command in the root folder of the existing project.
  4. Add all of the existing project’s files to the Git index and then commit.
  5. Add the GitHub repo as a remote reference for the existing project.
  6. Perform a git push operation with the -u and -f switches.
  7. Verify that the existing project’s files have been pushed to GitHub.

How to push code to GitHub

Many DevOps professionals only want to know the Git commands necessary to push their existing project to GitHub.

To save those readers from going through the entire example, here are the Git commands used in this tutorial. These commands assume a push to a GitHub repo named existing-website, owned by a GitHub user named cameronmcnz:


  • git init
  • git add .
  • git commit -m "Add existing project files to Git"
  • git remote add origin https://github.com/jaimemoncada/example-website.git
  • git push -u -f origin master
or
  • git push origin main

 or

  • git push -u -f origin main

Comments

Popular posts from this blog

Two simple ways to block internet browsing using Windows Firewall.

  Here are two simple ways to block internet browsing using Windows Firewall. Choose Method A (Block all browsers) or Method B (Block specific browsers like Chrome/Edge/Firefox). ✅ METHOD A — BLOCK ALL INTERNET BROWSING (Recommended) This blocks ALL internet access for ALL applications except those you allow. Steps: Press Windows + R Type: wf.msc Press Enter On the left, click Outbound Rules On the right, click New Rule… Select Custom → Next Under Program , choose All programs → Next Under Protocol and Ports , click Next Under Scope , click Next Under Action , select: ✔ Block the connection Click Next Under Profile , select: ✔ Domain ✔ Private ✔ Public Click Next Name the rule: Block Internet Browsing Click Finish ✔ This will instantly disable ALL internet access. 🟨 OPTIONAL: Allow exceptions If you want to allow EXCEPTIONS (example: allow only MT5, or allow Windows Update): Create a New Outbound Rule Select Program Browse to the app...

Block Browser Using Software Restriction Policy

Here are several alternative ways to block web browsers in Windows (Chrome, Edge, Firefox, etc.) without using the firewall method you mentioned earlier . Choose the method that best fits your need. 1 . Block Browser Using AppLocker (Windows Pro/Enterprise) Blocks the browser application from opening completely. Steps: Press Win + R , type: secpol.msc Go to: Application Control Policies → AppLocker → Executable Rules Right-click → Create New Rule Select: Deny User = Standard user (not Admin) Choose Path : Chrome: C:\Program Files\Google\Chrome\Application\chrome.exe Edge: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe Firefox: C:\Program Files\Mozilla Firefox\firefox.exe Apply. Result: User cannot open the browser. Admin still can. 2 . Block Browser Using Software Restriction Policy For Windows Pro. Steps: Press Win + R , type: gpedit.msc Navigate to: Computer Configuration → Windows Settings → Security Settings → Soft...

How to stop Windows 10 from upgrading to Windows 11

  ✅ Method 1 — Pause Updates (Temporary Only) Good if you just want to delay. Steps Go to Start → Settings → Windows Update Click Pause updates Choose how long to pause ➡ This only delays updates. After the pause period, updates resume automatically. ( Microsoft Support ) ✅ Method 2 — Block Windows 11 Using Group Policy (Best for Pro / Enterprise) This is the most recommended permanent method . Steps Press Win + R Type gpedit.msc Go to: Computer Configuration → Administrative Templates → Windows Components → Windows Update → Windows Update for Business Open Select the target Feature Update version Set to Enabled Enter your Windows 10 version (ex: 21H2 , 22H2 ) ➡ This forces your PC to stay on Windows 10 and not upgrade to Windows 11. ( Software Hubs ) ✅ Method 3 — Registry Method (Works for Windows 10 Home) If you don’t have Group Policy: Path HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate Create: DWORD → TargetReleaseVersion = 1 String → TargetReleaseVersionI...