Upload file by git lfs correctly - github

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

Related

Modifying a github public repository from a travis build

In the build of my first public repository https://github.com/yafred/test-push/ I try to modify my second repository https://github.com/yafred/test
1/ I am using the same personal access token with scope repo (GH_TOKEN) that I'm using to deploy releases.
2/ The commands I am executing from the .travis.yml are
language: generic
script:
- git clone https://github.com/yafred/test.git
- cd test
- echo "hello" > test.txt
- git add .
- git -c user.name='travis' -c user.email='travis' commit -m refresh
- git push -f -q https://{$GH_TOKEN}#github.com/yafred/test master
I have tried a few variations in the commands based on my searches but I keep getting an authentication error
0K$ git push -f -q https://{$GH_TOKEN}#github.com/yafred/test master
remote: Invalid username or password.
fatal: Authentication failed for 'https://{[secure]}#github.com/yafred/test/'
Is it at all possible ?
What am I doing wrong ?

How do I make powershell stop showing this message whenever I push

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.

How to Commit in github?

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

github file not getting committed

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.

How to create a new repo at Github using git bash?

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