I am new to GitHub, but I have followed the steps to create a repo:
$ mkdir fb
$ cd fb
$ git init
$ git add README
$ git commit -m 'first commit'
$ git push origin master
Now when I try to make my first commit, I get the follwowing error:
$ git push origin master
error: Cannot access URL https://github.com/xxx/yyy/, return code 60
error: failed to push some refs to 'https://github.com/xxx/yyy'
I am using the latest git version. Why does GitHub throw this unusal error and how do I fix it?
What if you try using the SSH protocol for the git repository, e.g. git#github.com:xxx/yyy.git, and see if that works for you?
$ git remote rm origin
$ git remote add origin git#github.com:xxx/yyy.git
I believe that return error code has something to do with the SSL Certificate... I'm sorry I cannot help further.
Related
I have been going at the endlessly all semester. I was able to add project from my prior year in school but have been unable to push and new projects to my repository.
I have tried deleting my key credentials via my key access chain.
I have created a new GitHub account and tried using that one.
I have deleted repositories started from scratch over and over.
I have read question on question and tried following multiple different answers on here.
What I wouldn't give to understand what is going on and why nothing seems to allow me to push a project anymore.
The most current attempt was going back to my original GitHub account.
I created a brand new repository.
I created a new folder and copied my simple python project into it and saved.
error: remote origin already exists.
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git remote rm origin
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git remote rm upstream
error: No such remote: 'upstream'
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. guess_a_random_number.py
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/stephaniebrandon/Documents/GitHubPortfolio/Python/GuessARandomNumberGame/pythonGame/.git/
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git push -u origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/stephanieBrandon/GuessARandomNumberGame.git'
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % ls -a
. .. .git guess_a_random_number.py
(base) stephaniebrandon#Stephanies-MacBook-Pro-2 pythonGame % git status
On branch master
I am hoping there is just some simple thing I am missing, if someone could explain and help me out it would be much appreciated.
Stephanie, your local branch name is "master", not "main" as you can see from the "git status" output.
If you try "git push origin master", it should work.
You dont have branch main, you have branch master. 😊
Try:
git push origin master
You need to have some commits before pushing your repository to Github.
Moreover, your local default branch name is master, so you have to use git push -u origin master instead of git push -u origin main
$ ls
guess_a_random_number.py
$ git init
Initialized empty Git repository in /Users/stephaniebrandon/Documents/GitHubPortfolio/Python/GuessARandomNumberGame/pythonGame/.git/
$ git add .
$ git commit -m "initial commit"
$ git remote add origin https://github.com/stephanieBrandon/GuessARandomNumberGame.git
$ git push -u origin master # not main
I tried to upload large file ( 240mb ) to github by lfs by using
- git lfs install
- git init
- git remote add origin "my repo url"
- git lfs track "*.weights"
- git add yolov3.weights
- git commit -m "test"
- git push -u origin master
after uploaded i found the file content
versionversion https://git-lfs.github.com/spec/v1
oid sha256:c49c28814dc8bcd2c48aac1c3e41c92a183cf9b282f6ca4c05f3d99393137952
size 246305388
And not working but the size still 240 mb
How to upload the file right or what is the wrong?
Did you try pushing the code using this command ?
git push origin <branch name> --force
HTTPS protocol can sometimes be unreliable when it comes to pushing large files . It may break unexpectedly
why dont you try pushing the code via SSH method ?
Run these commands below ::
ssh-keygen -t rsa -b 4096 -C "<email id>"
notepad ~/.ssh/<required key>.pub
// paste this public key into your github account
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<required_key>.pub
You can learn more about the ssh protocol in this article
How do I make powershell stop showing the below message:
github --credentials get: github: command not found
This occurs whenever I try to ssh for git push or git pull.
Check you git remote -v: it you see https, it is not an ssh url.
Make sure push or pull are using an ssh url with:
git remote set-url origin git#github.com:username/repo.git
If you are using https, Git will try and use a credential helper: see if git config -l | grep cred returns anything. That would explain the github: command not found part.
If you have, go to your repo and type:
cd /path/to/my/repo
git config credential.helper ""
If your git is recent enough (Git 2.9+), that will prevent any credential helper to be active in your repo.
I want to sync my code to my github repo, so anytime I update my code it should be updated in the repo. Is there any proper and structured way of doing this.
So this is how I am doing it now
1
$ cd my-project
$ git init
$ git remote add origin GITHUB_URL
$ git pull origin master
$ git status
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master
then just repeat following steps
$ git add .
$ git commit -m "Init repo."
$ git push -u origin master
i am getting error sh.exe: notepad: command not found please short out my problem
Thanks
For the commit to GitHub part, you need to add (if you have created an empty yourRepo on GitHub):
git config user.name yourGitHubUsername
git config user.email yourGitHubEmail
git add .
git commit -m "First commit"
git remote add origin https://yourAccount#github.com/yourAccount/yourRepo
git push -u origin master
If that fails because GitHub already created one commit when you initialized your "empty" repo (it can add by default a README.md and a .gitignore), do a:
git pull --rebase origin master
git push -u origin master
If you really have to call notepad from a mingw session, you can use this wrapper:
#!/bin/sh
'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar \
-nosession -noPlugin "$(cygpath -w "$*")"
But remember you can use msysgit from a DOS session as well.
Seps:
1.git init
2. git status
3. git add .
4. git commit -a
5. git status