I read through the doc for PkgTemplates and cannot figure out how to create a package that dose not have a .git folder. I need this way because because I am using Bitbucket and packages are private. Bitbucket will create the .git versioning for me. Any help is appreciated.
You can just override that. Create the package, point the remote to your bitbucket repo and push.
Edit: this can be done from the start with Template(;host="bitbucket.org")
Hi gustaphe thanks for the reply. I tried that. Template still creates the .git folder. See below.
using PkgTemplates
t = Template(;
user="username",
host="bitbucket.org",
dir="/home/dustin/Git/Projects/",
authors="Dustin",
julia=v"1.6.1",
plugins=[
License(; name="MIT"),
Develop(),
],
)
t("Test")
Yes, you want a .git
folder. Just run git add -A; git commit -m "initial commit"; git pull; git push
and you’ll be fully synched.
Edit: must add all the first time. Always forget.
Thank you. I will give this a try and reply back.
Hi gustaphe none of that worked. You have to create a repo in bit bucket but it already configures a master/rorigin and you can not change it. Then Template() generates a url based on the info you provide it, then it auto outputs a .jl. See below url in the .git config, which is wrong.
Navigating to the project root folder and ruining git command results int wrong url used even after explicitly defining the remote url to push and pull from.
[dustin@Odin-pc Test]$ git push -u origin master
Username for 'https://bitbucket.org': dustinthomas
Password for 'https://dustinthomas@bitbucket.org':
remote: The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
fatal: repository 'https://bitbucket.org/dustinthomas/Test.jl/' not found
because the url is wrong the repo doesn’t exist. So I change the Git() option to
Git(; jl=false)
and I get the same result. I have no idea why changing to the root directory of my project would result in git automatically looking form wrong repo especially when i explicitly tell it the url use.
git remote add bitbucket https://dustinthomas@bitbucket.org/dustinthomas/test.git
So eventually, I use the official tutorial on the Bit bucket website see bellow.
however because bit bucket doesn’t create a bare repo you need to modify the
git push --all bitbucket
to
git push --all --force btibucket
So in the end I am not sure if this git problem or a Templates problem. I have a workaround but it is not ideal to say the least. If this is a problem with PkgTemplates we should make the package creators aware. If it’s a lack knowledge on my part I happy to learn / change what I am doing.
You don’t need to force push, you just need to pull and resolve any merge conflicts before you push. I haven’t used bitbucket in a hot while, so I don’t know what stuff it puts in its repos by default, but this is a good general concept to know in git: you can’t push to a repo if there are changes in the remote that you don’t have locally.
Ok Let me give it a try again from scratch. See if it works
The problem was bitbucket was creating a .gitignore which is created by the template when creating the local repository. So I configured the bitbucket repository to not create this file. Then I used
git remote set-url origin <bitbucket_URL>
to set the correct repository url. Then
git push -u origin --all
This worked.
That too would be no issue if you followed my suggestion, because upon pulling the remote you would have been offered a choice of which (parts) of the two .gitignore
s to keep. But I’m glad it worked out.
You are correct sir. Help was much appreciated.