Reputation: 65
I am quite new to Git/Github. I am trying to upload my program / website to Github, so I can upload it to Heroku.
I tried a ton of different things, and I am stuck with this for over a week... As far as I know the way to do it is:
git init
git add .
git commit -m 'initial commit
the result I get is:
git init
> Reinitialized existing Git repository in /Users/username/test/website/.git/
git add .
> error: 'website/' does not have a commit checked out fatal: adding files failed
git commit -m 'initial commit
>
Untracked files:
(use "git add <file>..." to include in what will be committed)
website/
nothing added to commit but untracked files present (use "git add" to track)
What else can I do to set my website to Github?
Upvotes: 3
Views: 19430
Reputation: 280
Add existing locally hosted git repo to GitHub by running the following commands:
git remote add origin https://github.com/{some-user}/{some-repo}.git
git branch -M main
Then to push your first commit,
git add .
git commit -m "some comments"
git push --set-upstream origin main
Upvotes: 2
Reputation: 432
echo "# (your project name)" >> README.md
git init
git add README.md
git commit -m "first commit"
... ...
git remote add origin https://github.com/Here will be your github acc. name/(Your Repository name = Project name). git
git push -u origin main
remote add origin
remote set-url
https.. do rest as usual.Upvotes: 0
Reputation: 310
"Reinitialized existing Git repository in /Users/username/test/website/.git/",
It looks like you already have a local git repository on your computer. Next step is to create repository in the github, get the https link and do
git remote add origin <your repository https url>
git add .
git commit -m "intializing project"
git push origin <your branch name, ex. master>
Upvotes: 9
Reputation:
If you already have a local git repository on your computer you need to set the remotes to the remote git repository such as:
git remote add origin <link here>
Then you need to stage the changes:
git add .
git commit -m "Initial commit"
git push
Upvotes: 1