5/5
## Why Pushing Your Web3 Code to GitHub is Essential When transitioning from learning to actively seeking opportunities in the Web3 space, the most common question is: *"How do I get hired?"* The answer lies in the final, crucial step of your development workflow: sharing your project with the world. Hiring managers do not just want to see a resume; they want to see a public portfolio of your work. The entire blockchain industry is heavily decentralized and relies on open-source collaboration. Industry-standard projects like **go-ethereum (Geth)** (the Go implementation of Ethereum), **Vyper** (the Pythonic smart contract language), and **Moccasin** (the smart contract development framework) all live on GitHub. By pushing your smart contract code to a public repository, you allow the global developer community to view your work, review your code, and potentially collaborate. This builds your credibility and serves as the foundation of your Web3 developer profile. ## Understanding the Difference: Git vs. GitHub Before executing any commands, it is vital to understand the distinction between the two primary tools you will be using: * **Git:** This is a command-line tool installed directly on your local machine. It acts as a Version Control Management (VCM) system, meticulously tracking the history and changes of your local files. * **GitHub:** This is a centralized, cloud-based hosting platform. It acts as the destination where you push your local Git repositories so your code can be viewed, shared, and managed securely on the internet. ## Security First: The .env Pledge and .gitignore Before you even consider pushing code to GitHub, you must secure your sensitive data. Pushing private keys or mnemonic phrases to a public repository—even for a fraction of a second—guarantees that your wallet will be compromised. Automated bots continuously scrape GitHub for exposed keys and will drain real funds instantly. To protect your data, you will use a `.gitignore` file. This file explicitly tells Git which files and directories to completely ignore. These ignored files will never be tracked, staged, or pushed to GitHub. * **Framework Automation:** Modern frameworks like Moccasin automatically generate a `.gitignore` file for you, effectively graying out unnecessary or sensitive folders (such as `out/`, `build/`, `lib/`, and `broadcast/`). * **The .env Pledge:** Please take a look at the ["THE .ENV PLEDGE"](envpledge.cyfrin.io). This began as a simple commitment on GitHub, but is now a permanent oath on-chain. Please read through the pledge and mint your own personalized soul-bound NFT to show people your commitment to safe practices. Stay safe! *Pro-Tip: As a Web3 best practice, avoid putting raw private keys in a `.env` file altogether. Instead, use built-in keystores (like those provided by Moccasin) to encrypt your private keys via the command line.* ## Prerequisites and GitHub Repository Setup First, ensure that Git is properly installed on your local machine by running the following command in your terminal: ```bash git --version ``` If a version number is returned, you are ready to proceed. If not, you will need to install Git before moving forward. Next, you need to prepare the remote destination for your code: 1. Navigate to **GitHub.com** and log in to your account. 2. Click the **New Repository** button. 3. Provide a clear repository name (e.g., `mox-buy-me-a-coffee-cu`). 4. Set the repository visibility to **Public** so hiring managers and collaborators can view it. 5. **Important:** Do not check the boxes to add a README, `.gitignore`, or License. You already have these files configured in your local Web3 project. 6. Click **Create Repository**. ## Initializing Your Local Git Repository Open your terminal, navigate to the root directory of your Web3 project, and initialize an empty local Git repository. ```bash git init ``` This command creates a hidden `.git` folder inside your project directory. This hidden folder is the engine that tracks your project's entire commit history locally. ## Staging Your Files for Commit Git needs to know exactly which files you want to include in your next save state. To see what Git currently sees, check the status of your directory: ```bash git status ``` You will likely see a list of red "Untracked files." To tell Git to track and stage all valid files—while strictly respecting the rules in your `.gitignore`—use the "add dot" command: ```bash git add . ``` Running `git status` again will now display these files in green, categorized under "Changes to be committed." *Tip: If you accidentally stage a file you realize you do not want to commit just yet (such as an unfinished README), you can safely unstage it without deleting the file by running:* ```bash git rm --cached README.md ``` ## Committing Your Web3 Code A commit functions as a permanent snapshot of your code at a specific point in time. To save this snapshot to your local history, run: ```bash git commit -m "our first commit" ``` * `git commit`: The core command instructing Git to save the staged snapshot. * `-m`: The message flag, allowing you to attach a human-readable note to the commit. * `"our first commit"`: The descriptive message explaining the purpose of this snapshot. To verify that your commit was successfully recorded, you can view your project's historical timeline: ```bash git log ``` This command outputs your commit history, detailing the unique commit hash, the author, the exact timestamp, and your commit message. ## Linking Your Local Repository to GitHub At this stage, your local machine has a properly tracked Git history, but it has no connection to the internet. You must explicitly link your local repository to the empty GitHub repository you created earlier. Go back to your GitHub repository page, copy the provided repository URL, and run the following command in your terminal: ```bash git remote add origin https://github.com/your-username/mox-buy-me-a-coffee-cu.git ``` To ensure the link was established correctly, check your remote configurations: ```bash git remote -v ``` This will display the specific URLs designated for "fetch" and "push" operations, confirming exactly where your code will be routed. ## Pushing Your Code to the Cloud The final technical step is to push your locally committed history up to the remote GitHub server. ```bash git push -u origin main ``` * `push`: The command that transmits your local code to the remote cloud server. * `-u`: The upstream flag. This sets "origin main" as your default destination, meaning for future updates, you only need to type `git push`. * `origin`: The standard alias for your remote repository URL. * `main`: The primary branch containing your committed code. Once the terminal finishes processing the upload, refresh your GitHub repository page in your browser. Your smart contract code is now live on the internet! ## Troubleshooting Git Authentication Errors with AI It is common to run into authentication errors when pushing code for the first time, such as a `403 fatal: unable to access` error. This typically stems from outdated password authentications, as GitHub now requires modern security measures. If you encounter Git configuration, authentication, or SSH key errors, the most efficient troubleshooting method is to utilize AI tools like Claude or ChatGPT. AI is exceptional at triaging environment-specific terminal issues. **Example AI Prompt:** *"How do I sign into my Git config on my command line?"* The AI will provide step-by-step instructions tailored to your operating system, guiding you through generating Personal Access Tokens (PATs) or creating SSH keys to securely authenticate your terminal with GitHub. ## Next Steps for Your Web3 Developer Portfolio Now that your code is successfully hosted on GitHub, you must make it presentable. It is highly recommended to write a clean, well-structured `README.md` file. Frameworks like Moccasin provide excellent templates for this. A strong README ensures that visiting developers and hiring managers understand what your project does, how to install it, and how to interact with your smart contracts. Finally, take the link to your newly populated GitHub repository and connect it to a **Cyfrin Profile**. This bridges the gap between your raw code and your professional Web3 resume, allowing you to start participating in competitive smart contract audits and officially launching your Web3 career.
When transitioning from learning to actively seeking opportunities in the Web3 space, the most common question is: "How do I get hired?" The answer lies in the final, crucial step of your development workflow: sharing your project with the world.
Hiring managers do not just want to see a resume; they want to see a public portfolio of your work. The entire blockchain industry is heavily decentralized and relies on open-source collaboration. Industry-standard projects like go-ethereum (Geth) (the Go implementation of Ethereum), Vyper (the Pythonic smart contract language), and Moccasin (the smart contract development framework) all live on GitHub.
By pushing your smart contract code to a public repository, you allow the global developer community to view your work, review your code, and potentially collaborate. This builds your credibility and serves as the foundation of your Web3 developer profile.
Before executing any commands, it is vital to understand the distinction between the two primary tools you will be using:
Git: This is a command-line tool installed directly on your local machine. It acts as a Version Control Management (VCM) system, meticulously tracking the history and changes of your local files.
GitHub: This is a centralized, cloud-based hosting platform. It acts as the destination where you push your local Git repositories so your code can be viewed, shared, and managed securely on the internet.
Before you even consider pushing code to GitHub, you must secure your sensitive data. Pushing private keys or mnemonic phrases to a public repository—even for a fraction of a second—guarantees that your wallet will be compromised. Automated bots continuously scrape GitHub for exposed keys and will drain real funds instantly.
To protect your data, you will use a .gitignore file. This file explicitly tells Git which files and directories to completely ignore. These ignored files will never be tracked, staged, or pushed to GitHub.
Framework Automation: Modern frameworks like Moccasin automatically generate a .gitignore file for you, effectively graying out unnecessary or sensitive folders (such as out/, build/, lib/, and broadcast/).
The .env Pledge: Please take a look at the "THE .ENV PLEDGE". This began as a simple commitment on GitHub, but is now a permanent oath on-chain. Please read through the pledge and mint your own personalized soul-bound NFT to show people your commitment to safe practices. Stay safe!
Pro-Tip: As a Web3 best practice, avoid putting raw private keys in a .env file altogether. Instead, use built-in keystores (like those provided by Moccasin) to encrypt your private keys via the command line.
First, ensure that Git is properly installed on your local machine by running the following command in your terminal:
If a version number is returned, you are ready to proceed. If not, you will need to install Git before moving forward.
Next, you need to prepare the remote destination for your code:
Navigate to GitHub.com and log in to your account.
Click the New Repository button.
Provide a clear repository name (e.g., mox-buy-me-a-coffee-cu).
Set the repository visibility to Public so hiring managers and collaborators can view it.
Important: Do not check the boxes to add a README, .gitignore, or License. You already have these files configured in your local Web3 project.
Click Create Repository.
Open your terminal, navigate to the root directory of your Web3 project, and initialize an empty local Git repository.
This command creates a hidden .git folder inside your project directory. This hidden folder is the engine that tracks your project's entire commit history locally.
Git needs to know exactly which files you want to include in your next save state. To see what Git currently sees, check the status of your directory:
You will likely see a list of red "Untracked files." To tell Git to track and stage all valid files—while strictly respecting the rules in your .gitignore—use the "add dot" command:
Running git status again will now display these files in green, categorized under "Changes to be committed."
Tip: If you accidentally stage a file you realize you do not want to commit just yet (such as an unfinished README), you can safely unstage it without deleting the file by running:
A commit functions as a permanent snapshot of your code at a specific point in time. To save this snapshot to your local history, run:
git commit: The core command instructing Git to save the staged snapshot.
-m: The message flag, allowing you to attach a human-readable note to the commit.
"our first commit": The descriptive message explaining the purpose of this snapshot.
To verify that your commit was successfully recorded, you can view your project's historical timeline:
This command outputs your commit history, detailing the unique commit hash, the author, the exact timestamp, and your commit message.
At this stage, your local machine has a properly tracked Git history, but it has no connection to the internet. You must explicitly link your local repository to the empty GitHub repository you created earlier.
Go back to your GitHub repository page, copy the provided repository URL, and run the following command in your terminal:
To ensure the link was established correctly, check your remote configurations:
This will display the specific URLs designated for "fetch" and "push" operations, confirming exactly where your code will be routed.
The final technical step is to push your locally committed history up to the remote GitHub server.
push: The command that transmits your local code to the remote cloud server.
-u: The upstream flag. This sets "origin main" as your default destination, meaning for future updates, you only need to type git push.
origin: The standard alias for your remote repository URL.
main: The primary branch containing your committed code.
Once the terminal finishes processing the upload, refresh your GitHub repository page in your browser. Your smart contract code is now live on the internet!
It is common to run into authentication errors when pushing code for the first time, such as a 403 fatal: unable to access error. This typically stems from outdated password authentications, as GitHub now requires modern security measures.
If you encounter Git configuration, authentication, or SSH key errors, the most efficient troubleshooting method is to utilize AI tools like Claude or ChatGPT. AI is exceptional at triaging environment-specific terminal issues.
Example AI Prompt: "How do I sign into my Git config on my command line?"
The AI will provide step-by-step instructions tailored to your operating system, guiding you through generating Personal Access Tokens (PATs) or creating SSH keys to securely authenticate your terminal with GitHub.
Now that your code is successfully hosted on GitHub, you must make it presentable. It is highly recommended to write a clean, well-structured README.md file. Frameworks like Moccasin provide excellent templates for this. A strong README ensures that visiting developers and hiring managers understand what your project does, how to install it, and how to interact with your smart contracts.
Finally, take the link to your newly populated GitHub repository and connect it to a Cyfrin Profile. This bridges the gap between your raw code and your professional Web3 resume, allowing you to start participating in competitive smart contract audits and officially launching your Web3 career.
A comprehensive guide to pushing your code to GitHub. The lesson covers creating a new repository, adding files to the repository, staging and committing changes, and pushing your commit to the GitHub remote.
Previous lesson
Previous
Next lesson
Next
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on November 7, 2025
Duration: 2h 21min
Duration: 1h 51min
Duration: 59min
Duration: 2h 23min
Duration: 53min
Duration: 2h 25min
Duration: 29min
Duration: 1h 54min
Duration: 12min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on November 7, 2025