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
I want to pysh my project to a github repository called luna.git:
I followed the instructions
echo “# luna” >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/raouiyounes/luna.git
git push -u origin master
But I get this error
error: src refspec master does not match any.
error: impossible de pousser des références vers ‘https://github.com/raouiyounes/luna.git’
Maybe you just need to commit.
Try this:
git add .
git commit -m "initial commit"
git push origin master
You can do :
git push origin HEAD:branch-name
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
How can I create a new repository from my machine using git bash?
I followed the below steps:
mkdir ~/Hello-World
cd ~/Hello-World
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/username/Hello-World.git
git push origin master
But I'm getting "Fatal error: did you run update-server-info on the server? "
You cannot create a repo on github using git bash. Git and github are different things. Github is a platform that let's you host and collaborate on code while git is the version control tool used. You can read more about them on wikipedia articles: github and git.
However if your intention is to create a github repo using terminal, you can do it using the github api and curl.
Probably the easiest way to create a repo on github is somewhere before this line:
git remote add origin https://github.com/username/Hello-World.git
go to https://github.com/new and create a repository on github, then run your last two lines and everything should work.
I have created this bash file to do it all automatically.
#!/bin/sh
reponame="$1"
if [ "$reponame" = "" ]; then
read -p "Enter Github Repository Name: " reponame
fi
mkdir ./$reponame
cd $reponame
curl -u USERNAME https://api.github.com/user/repos -d "{\"name\":\"$reponame\"}"
git init
echo "ADD README CONTENT" > README.md
git add README.md
git commit -m "Starting Out"
git remote add origin git#github.com:USERNAME/$reponame.git
git push -u origin master
So how:
copy the code above. save it as NAME.sh, add it to your PATH. restart terminal or open a new one.
$ NAME newreponame
$ NAME
$ Enter Github Repository Name:
Thanks.
First, try to do this right before the git push:
git pull repo branch
Then try to do the following:
$ git init --bare yourreponame.git
Then do what you were doing before:
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/username/Hello-World.git
git push origin master
I think it is doable.
You can do it using curl (if you are on Windows, you'll have to install it)
curl -u USER https://api.github.com/user/repos -d '{ "name": "REPO" }'
Make sure to replace USER and REPO with your github username and the name of the repository you want to create respectively
It asks for password, input your github admin password and you are good to go.
Actually answered by James Barnett here https://teamtreehouse.com/community/how-does-one-add-a-repository-to-github-using-git-commandline-calls-only
Overview
Command 'git' do not allow you to create repo but it's possible to create new repo at github from BASH script. All solutions use user/password authentication which is deplicated but stil in use. Authentication must be done using personal access token.
Below there are solutions:
3rd party application
https://github.com/github/hub
sudo apt install hub;
cd <folder with code>;
hub init;
hub create -p -d "<repo description>" -h "<project site>" \
"user_name>/<repo_name>";
More options: https://hub.github.com/hub-create.1.html
Pure BASH
REPONAME="TEST";
DOMAIN="www.example.com";
DESCRIPTION="Repo Description";
GITHUB_USER="github_user";
FOLDER="$HOME/temp/$REPONAME";
mkdir -p "$FOLDER"; cd "$FOLDER";
read -r -d '' JSON_TEMPLATE << EOF
{
"name" : "%s",
"description" : "%s",
"homepage" : "%s",
"visibility" : "private",
"private" : true,
"has_issues" : false,
"has_downloads" : false,
"has_wiki" : false,
"has_projects" : false
}
EOF
JSON_OUTPUT=$(printf "$JSON_TEMPLATE" "$REPO_NAME" \
"$DESCRIPTION" "http://$DOMAIN");
# https://developer.github.com/v3/repos/#create-an-organization-repository
curl -u ${GITHUB_USER} https://api.github.com/user/repos \
-d "$JSON_OUTPUT"
just try to add -u in your last line:
git push -u origin master
Maybe you are getting this error because you didn't set your identity:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe#example.com
Here you can find the steps to create and put your repository on github:
http://programertools.blogspot.com/2014/04/how-to-use-github.html