This document provides instructions for uploading the AI Agent code to your GitHub repository using the generated SSH key.
- You have already added the SSH key to your GitHub account as described in the SSH Setup Guide
- You have created a repository on GitHub for this project (e.g.,
ai-agent)
First, set up your Git configuration with your GitHub username and email if you haven't already:
git config --global user.name "Your GitHub Username"
git config --global user.email "your.email@example.com"Navigate to the project directory and initialize a Git repository (if not already done by the user):
cd /home/ubuntu/ai-agent
git initEnsure a .gitignore file exists to exclude unnecessary files. A good starting point would be:
cat > .gitignore << EOF
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
# Virtual Environment
venv/
ENV/
# Model files (large files - consider Git LFS for these if you must commit them)
models/*
!models/.gitkeep
# If you download models into a subdirectory of models, e.g. models/Llama3.1-8B-Instruct,
# and want to keep the directory structure but not the large files:
# models/Llama3.1-8B-Instruct/*
# !models/Llama3.1-8B-Instruct/.gitkeep
# Logs
logs/
*.log
model_server.log
# Local configuration
.env
.env.local
# IDE specific files
.idea/
.vscode/
*.swp
*.swo
# OS generated files
.DS_Store
Thumbs.db
EOFIt's generally recommended not to commit large model files directly to Git. The models/* entry above will ignore them. Use a .gitkeep file inside models/ if you want to keep the directory itself in Git.
Add your GitHub repository as the remote origin (replace username and repository-name):
# Example: git remote add origin git@github.com:your-username/ai-agent.git
git remote add origin git@github.com:username/repository-name.gitIf a remote named origin already exists, you might need to update it:
git remote set-url origin git@github.com:username/repository-name.gitTo ensure Git uses the correct SSH key (if you have multiple or non-standard keys), you can either:
-
Create or edit
~/.ssh/configfile (recommended for persistent configuration):Host github.com HostName github.com User git IdentityFile ~/.ssh/github_rsa # Or your specific key for this project -
Or use the
GIT_SSH_COMMANDenvironment variable for each Git command (less common for regular use):GIT_SSH_COMMAND="ssh -i ~/.ssh/github_rsa" git push -u origin main
Add all relevant project files to the Git repository and create an initial commit:
cd /home/ubuntu/ai-agent
git add .
git commit -m "Initial commit: AI Agent project with Llama3.1-8B-Instruct model setup"Push the code to your GitHub repository (assuming your main branch is named main):
git push -u origin mainIf you are using a different branch name (e.g., "master"), adjust the command accordingly.
Visit your GitHub repository in a web browser to verify that all intended files have been uploaded successfully.
If you encounter permission issues:
- Verify that the SSH public key (
~/.ssh/github_rsa.pubor your specific key) has been added to your GitHub account. - Check SSH private key permissions:
chmod 600 ~/.ssh/github_rsa # Or your specific private key file
- Test SSH connection to GitHub:
You should see a message like: "Hi username! You've successfully authenticated, but GitHub does not provide shell access."
ssh -T git@github.com -i ~/.ssh/github_rsa # Or your specific key
If you encounter issues with large files being rejected, ensure they are correctly listed in .gitignore. For very large files that must be versioned (not recommended for models), research and use Git LFS (Large File Storage).