fixed the missing files
This commit is contained in:
18
bin/inc_new_project/git_setup.sh
Normal file
18
bin/inc_new_project/git_setup.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECTNAME=$(basename "$(pwd)")
|
||||
|
||||
# Remove existing Git repository information
|
||||
rm -rf .git
|
||||
|
||||
rm README.md
|
||||
touch README.md
|
||||
echo "# ${PROJECTNAME}" > README.md
|
||||
echo "" > README.md
|
||||
echo "Created a fresh repo for your ${PROJECTNAME} project." >> README.md
|
||||
|
||||
# Initialize a new Git repository
|
||||
echo -e "\n\e[32mSetup Git Locally\e[0m\n";
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit of new project $PROJECTNAME"
|
||||
32
bin/inc_new_project/remote_git_setup.sh
Normal file
32
bin/inc_new_project/remote_git_setup.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROJECTNAME=$(basename "$(pwd)")
|
||||
|
||||
echo -e "\n\e[32mSetup Git Remotely\e[0m\n";
|
||||
|
||||
DESC="Repo auto created by Joomla remote git script creator for $PROJECTNAME"
|
||||
|
||||
# Create the repository using Gitea API
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
-H "Authorization: token $ACCESS_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\":\"$PROJECTNAME\",\"private\": true,\"description\": \"$DESC\"}" \
|
||||
$GITEA_API_URL/user/repos)
|
||||
|
||||
if [ -z "$RESPONSE" ] || [ "$(echo "$RESPONSE" | jq -r '.id')" = "null" ]; then
|
||||
echo "Error: Failed to create $PROJECTNAME repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SSH_URL=$(echo "$RESPONSE" | jq -r '.ssh_url')
|
||||
if [ "$SSH_URL" = "null" ]; then
|
||||
echo "Error: Failed to retrieve SSH URL for $PROJECTNAME repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add new remote repository
|
||||
git remote add origin "$SSH_URL"
|
||||
git remote -v
|
||||
|
||||
# Commit existing changes
|
||||
git push -u origin master
|
||||
Reference in New Issue
Block a user